microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFile.java
@DoesServiceRequest
    protected final int downloadRangeInternal(final long fileOffset, final Long length, final byte[] buffer,
            final int bufferOffset, final AccessCondition accessCondition, FileRequestOptions options,
            OperationContext opContext) throws StorageException {

        if (bufferOffset < 0 || fileOffset < 0 || (length != null && length <= 0)) {
            throw new IndexOutOfBoundsException();
        }

        if (opContext == null) {
            opContext = new OperationContext();
        }

        options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient);
        
        WrappedByteArrayOutputStream outputStream = new WrappedByteArrayOutputStream(buffer, bufferOffset);
        ExecutionEngine.executeWithRetry(this.fileServiceClient, this,
                this.downloadToStreamImpl(fileOffset, length, outputStream, accessCondition, options, opContext),
                options.getRetryPolicyFactory(), opContext);
        return outputStream.getPosition();
    }
@DoesServiceRequest
    protected final int downloadRangeInternal(final long fileOffset, final Long length, final byte[] buffer,
            final int bufferOffset, final AccessCondition accessCondition, FileRequestOptions options,
            OperationContext opContext) throws StorageException {

        if (bufferOffset < 0 || fileOffset < 0 || (length != null && length <= 0)) {
            throw new IndexOutOfBoundsException();
        }

        if (opContext == null) {
            opContext = new OperationContext();
        }

        options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient);
        
        WrappedByteArrayOutputStream outputStream = new WrappedByteArrayOutputStream(buffer, bufferOffset);
        ExecutionEngine.executeWithRetry(this.fileServiceClient, this,
                this.downloadToStreamImpl(fileOffset, length, outputStream, accessCondition, options, opContext),
                options.getRetryPolicyFactory(), opContext);
        return outputStream.getPosition();
    }
@ DoesServiceRequest protected final int downloadRangeInternal ( final long fileOffset , final Long length , final byte [ ] buffer , final int bufferOffset , final AccessCondition accessCondition , FileRequestOptions options , OperationContext opContext ) throws StorageException { if ( bufferOffset < 0 || fileOffset < 0 || ( length != null && length <= 0 ) ) { throw new IndexOutOfBoundsException ( ) ; } if ( opContext == null ) { opContext = new OperationContext ( ) ; } options = FileRequestOptions . populateAndApplyDefaults ( options , this . fileServiceClient ) ; WrappedByteArrayOutputStream outputStream = new WrappedByteArrayOutputStream ( buffer , bufferOffset ) ; ExecutionEngine . executeWithRetry ( this . fileServiceClient , this , this . downloadToStreamImpl ( fileOffset , length , outputStream , accessCondition , options , opContext ) , options . getRetryPolicyFactory ( ) , opContext ) ; return outputStream . getPosition ( ) ; }
Downloads a range of bytes from the file to the given byte buffer.

@param fileOffset
A <code>long</code> which represents the offset within the file to begin downloading.
@param length
A <code>Long</code> which represents the number of bytes to read.
@param buffer
A <code>byte</code> array which represents the buffer to write to.
@param bufferOffset
An <code>int</code> which represents the offset in the byte buffer to begin writing.
@param accessCondition
An {@link AccessCondition} object that represents the access conditions for the file.
@param options
A {@link FileRequestOptions} object that specifies any additional options for the request.
@param opContext
An {@link OperationContext} object used to track the execution of the operation.
@throws StorageException
an exception representing any error which occurred during the operation.
Downloads a range of bytes from the file to the given byte buffer .