microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java
@DoesServiceRequest
    public void upload(final InputStream sourceStream, final long length, final AccessCondition accessCondition,
            FileRequestOptions options, OperationContext opContext) throws StorageException, IOException, URISyntaxException {
        if (opContext == null) {
            opContext = new OperationContext();
        }

        this.getShare().assertNoSnapshot();

        options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient);

        if (length < 0) {
            throw new IllegalArgumentException(SR.INVALID_FILE_LENGTH);
        }

        if (sourceStream.markSupported()) {
            // Mark sourceStream for current position.
            sourceStream.mark(Constants.MAX_MARK_LENGTH);
        }

        final FileOutputStream streamRef = this.openWriteNew(length, accessCondition, options, opContext);
        try {
            streamRef.write(sourceStream, length);
        }
        finally {
            streamRef.close();
        }
    }
@DoesServiceRequest
    public void upload(final InputStream sourceStream, final long length, final AccessCondition accessCondition,
            FileRequestOptions options, OperationContext opContext) throws StorageException, IOException, URISyntaxException {
        if (opContext == null) {
            opContext = new OperationContext();
        }

        this.getShare().assertNoSnapshot();

        options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient);

        if (length < 0) {
            throw new IllegalArgumentException(SR.INVALID_FILE_LENGTH);
        }

        if (sourceStream.markSupported()) {
            // Mark sourceStream for current position.
            sourceStream.mark(Constants.MAX_MARK_LENGTH);
        }

        final FileOutputStream streamRef = this.openWriteNew(length, accessCondition, options, opContext);
        try {
            streamRef.write(sourceStream, length);
        }
        finally {
            streamRef.close();
        }
    }
Uploads the source stream data to the file using the specified access condition, request options, and operation
context. If the file already exists on the service, it will be overwritten.

@param sourceStream
An {@link InputStream} object to read from.
@param length
A <code>long</code> which represents the length, in bytes, of the stream data. This must be greater than
or equal to zero.
@param accessCondition
An {@link AccessCondition} object which represents the access conditions for the file.
@param options
A {@link FileRequestOptions} object that specifies any additional options for the request. Specifying
<code>null</code> will use the default request options from the associated service client (
{@link CloudFileClient}).
@param opContext
An {@link OperationContext} object which represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.

@throws IOException
If an I/O exception occurred.
@throws StorageException
If a storage service error occurred.
@throws URISyntaxException