code: public static AsyncInputStream toAsyncInputStream(final InputStream inputStream) {
          notNull("inputStream", inputStream);
          return new AsyncInputStream() {
              @Override
              public void read(final ByteBuffer dstByteBuffer, final SingleResultCallback<Integer> callback) {
                  notNull("dst", dstByteBuffer);
                  notNull("callback", callback);
                  if (!dstByteBuffer.hasRemaining()) {
                      callback.onResult(-1, null);
                      return;
                  }
  
                  int maxAmount = dstByteBuffer.remaining();
                  byte[] bytes = new byte[maxAmount];
                  int amountRead;
                  try {
                      amountRead = inputStream.read(bytes);
                  } catch (Throwable t) {
                      callback.onResult(null, new MongoGridFSException("Error reading from input stream", t));
                      return;
                  }
  
                  if (amountRead > 0) {
                      if (amountRead < maxAmount) {
                          byte[] dataRead = new byte[amountRead];
                          System.arraycopy(bytes, 0, dataRead, 0, amountRead);
                          dstByteBuffer.put(dataRead);
                      } else {
                          dstByteBuffer.put(bytes);
                      }
                  }
                  callback.onResult(amountRead, null);
              }
  
              @Override
              public void skip(final long bytesToSkip, final SingleResultCallback<Long> callback) {
                  notNull("callback", callback);
                  try {
                      long skipped = inputStream.skip(bytesToSkip);
                      callback.onResult(skipped, null);
                  } catch (Throwable t) {
                      callback.onResult(null, t);
                  }
              }
  
              @Override
              public void close(final SingleResultCallback<Void> callback) {
                  try {
                      inputStream.close();
                  } catch (Throwable t) {
                      callback.onResult(null, new MongoGridFSException("Error closing input stream", t));
                      return;
                  }
                  callback.onResult(null, null);
              }
          };
      }
docs: Converts a {@link InputStream} into a {@link AsyncInputStream}
  
  @param inputStream the InputStream
  @return the AsyncInputStream