本文整理汇总了Java中java.nio.channels.AsynchronousByteChannel类的典型用法代码示例。如果您正苦于以下问题:Java AsynchronousByteChannel类的具体用法?Java AsynchronousByteChannel怎么用?Java AsynchronousByteChannel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AsynchronousByteChannel类属于java.nio.channels包,在下文中一共展示了AsynchronousByteChannel类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInputStream
import java.nio.channels.AsynchronousByteChannel; //导入依赖的package包/类
@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;
}
示例2: getOutputStream
import java.nio.channels.AsynchronousByteChannel; //导入依赖的package包/类
@Override
protected OutputStream getOutputStream() {
if (outputStream == null) {
if (channel instanceof AsynchronousByteChannel) {
outputStream = new AsynchronousByteChannelOutputStream((AsynchronousByteChannel) channel);
} else {
outputStream = Channels.newOutputStream((WritableByteChannel) channel);
}
}
return outputStream;
}
示例3: sendUrgentData
import java.nio.channels.AsynchronousByteChannel; //导入依赖的package包/类
@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();
}
示例4: adapt
import java.nio.channels.AsynchronousByteChannel; //导入依赖的package包/类
public static CompletableAsynchronousByteChannel adapt(AsynchronousByteChannel original) {
if (original instanceof CompletableAsynchronousByteChannel) {
return (CompletableAsynchronousByteChannel)original;
}
return new Adapter(original);
}
示例5: Adapter
import java.nio.channels.AsynchronousByteChannel; //导入依赖的package包/类
private Adapter(AsynchronousByteChannel delegate) {
this.delegate = delegate;
}
示例6: AsynchronousByteChannelInputStream
import java.nio.channels.AsynchronousByteChannel; //导入依赖的package包/类
AsynchronousByteChannelInputStream(AsynchronousByteChannel channel, int timeout) {
this.channel = channel;
this.timeout = timeout;
}
示例7: AsynchronousByteChannelOutputStream
import java.nio.channels.AsynchronousByteChannel; //导入依赖的package包/类
AsynchronousByteChannelOutputStream(AsynchronousByteChannel channel) {
this.channel = channel;
}