Java 类java.nio.channels.AsynchronousByteChannel 实例源码

项目:jephyr    文件:NioSocketImpl.java   
@Override
protected InputStream getInputStream() {
    if (inputStream == null) {
        if (channel instanceof AsynchronousByteChannel) {
            inputStream = new AsynchronousByteChannelInputStream((AsynchronousByteChannel) channel, timeout);
        } else {
            inputStream = Channels.newInputStream((ReadableByteChannel) channel);
        }
    }
    return inputStream;
}
项目:jephyr    文件:NioSocketImpl.java   
@Override
protected OutputStream getOutputStream() {
    if (outputStream == null) {
        if (channel instanceof AsynchronousByteChannel) {
            outputStream = new AsynchronousByteChannelOutputStream((AsynchronousByteChannel) channel);
        } else {
            outputStream = Channels.newOutputStream((WritableByteChannel) channel);
        }
    }
    return outputStream;
}
项目:jephyr    文件:NioSocketImpl.java   
@Override
protected void sendUrgentData(int data) throws IOException {
    if (outputStream == null) {
        if (channel instanceof AsynchronousByteChannel) {
            outputStream = new AsynchronousByteChannelOutputStream((AsynchronousByteChannel) channel);
        } else {
            outputStream = Channels.newOutputStream((WritableByteChannel) channel);
        }
    }
    outputStream.write(data);
    outputStream.flush();
}
项目:tascalate-async-await    文件:CompletableAsynchronousByteChannel.java   
public static CompletableAsynchronousByteChannel adapt(AsynchronousByteChannel original) {
    if (original instanceof CompletableAsynchronousByteChannel) {
        return (CompletableAsynchronousByteChannel)original;
    }
    return new Adapter(original);
}
项目:tascalate-async-await    文件:CompletableAsynchronousByteChannel.java   
private Adapter(AsynchronousByteChannel delegate) {
    this.delegate = delegate;
}
项目:jephyr    文件:NioSocketImpl.java   
AsynchronousByteChannelInputStream(AsynchronousByteChannel channel, int timeout) {
    this.channel = channel;
    this.timeout = timeout;
}
项目:jephyr    文件:NioSocketImpl.java   
AsynchronousByteChannelOutputStream(AsynchronousByteChannel channel) {
    this.channel = channel;
}