driver-async/src/main/com/mongodb/async/client/gridfs/helpers/AsyncStreamHelper.java
public static AsyncInputStream toAsyncInputStream(final ByteBuffer srcByteBuffer) {
        notNull("srcByteBuffer", srcByteBuffer);
        return new AsyncInputStream() {
            @Override
            public void read(final ByteBuffer dstByteBuffer, final SingleResultCallback<Integer> callback) {
                transferDataFromByteBuffers(srcByteBuffer, dstByteBuffer, callback);
            }

            @Override
            public void skip(final long bytesToSkip, final SingleResultCallback<Long> callback) {
                notNull("callback", callback);
                callback.onResult(0L, null);
            }

            @Override
            public void close(final SingleResultCallback<Void> callback) {
                callback.onResult(null, null);
            }
        };
    }
public static AsyncInputStream toAsyncInputStream(final ByteBuffer srcByteBuffer) {
        notNull("srcByteBuffer", srcByteBuffer);
        return new AsyncInputStream() {
            @Override
            public void read(final ByteBuffer dstByteBuffer, final SingleResultCallback<Integer> callback) {
                transferDataFromByteBuffers(srcByteBuffer, dstByteBuffer, callback);
            }

            @Override
            public void skip(final long bytesToSkip, final SingleResultCallback<Long> callback) {
                notNull("callback", callback);
                callback.onResult(0L, null);
            }

            @Override
            public void close(final SingleResultCallback<Void> callback) {
                callback.onResult(null, null);
            }
        };
    }
Converts a {@link ByteBuffer} into a {@link AsyncInputStream}

@param srcByteBuffer the data source
@return the AsyncInputStream