public static AsyncInputStream channelToInputStream(final AsynchronousByteChannel asynchronousByteChannel) {
    """
	Converts a {@link AsynchronousByteChannel} into a {@link AsyncInputStream}
	
	@param asynchronousByteChannel the AsynchronousByteChannel
	@return the AsyncInputStream
    """
        notNull("asynchronousByteChannel", asynchronousByteChannel);
        return new AsyncInputStream() {
            @Override
            public void read(final ByteBuffer dst, final SingleResultCallback<Integer> callback) {
                asynchronousByteChannel.read(dst, null, new CompletionHandler<Integer, Object>() {
                    @Override
                    public void completed(final Integer result, final Object attachment) {
                        callback.onResult(result, null);
                    }

                    @Override
                    public void failed(final Throwable exc, final Object attachment) {
                        callback.onResult(null, exc);
                    }
                });
            }

            @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) {
                try {
                    asynchronousByteChannel.close();
                    callback.onResult(null, null);
                } catch (Exception e) {
                    callback.onResult(null, e);
                }
            }
        };
    }
public static AsyncInputStream channelToInputStream(final AsynchronousByteChannel asynchronousByteChannel) {
        notNull("asynchronousByteChannel", asynchronousByteChannel);
        return new AsyncInputStream() {
            @Override
            public void read(final ByteBuffer dst, final SingleResultCallback<Integer> callback) {
                asynchronousByteChannel.read(dst, null, new CompletionHandler<Integer, Object>() {
                    @Override
                    public void completed(final Integer result, final Object attachment) {
                        callback.onResult(result, null);
                    }

                    @Override
                    public void failed(final Throwable exc, final Object attachment) {
                        callback.onResult(null, exc);
                    }
                });
            }

            @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) {
                try {
                    asynchronousByteChannel.close();
                    callback.onResult(null, null);
                } catch (Exception e) {
                    callback.onResult(null, e);
                }
            }
        };
    }
public static AsyncInputStream channelToInputStream ( final AsynchronousByteChannel asynchronousByteChannel ) { notNull ( "asynchronousByteChannel" , asynchronousByteChannel ) ; return new AsyncInputStream ( ) { @ Override public void read ( final ByteBuffer dst , final SingleResultCallback < Integer > callback ) { asynchronousByteChannel . read ( dst , null , new CompletionHandler < Integer , Object > ( ) { @ Override public void completed ( final Integer result , final Object attachment ) { callback . onResult ( result , null ) ; } @ Override public void failed ( final Throwable exc , final Object attachment ) { callback . onResult ( null , exc ) ; } } ) ; } @ 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 ) { try { asynchronousByteChannel . close ( ) ; callback . onResult ( null , null ) ; } catch ( Exception e ) { callback . onResult ( null , e ) ; } } } ; }
Converts a {@link AsynchronousByteChannel} into a {@link AsyncInputStream}

@param asynchronousByteChannel the AsynchronousByteChannel
@return the AsyncInputStream
Converts a { @link AsynchronousByteChannel } into a { @link AsyncInputStream }