本文整理了Java中org.xnio.IoUtils.transfer()
方法的一些代码示例,展示了IoUtils.transfer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IoUtils.transfer()
方法的具体详情如下:
包路径:org.xnio.IoUtils
类名称:IoUtils
方法名:transfer
[英]Platform-independent channel-to-channel transfer method. Uses regular read and write operations to move bytes from the source channel to the sink channel. After this call, the throughBuffershould be checked for remaining bytes; if there are any, they should be written to the sink channel before proceeding. This method may be used with NIO channels, XNIO channels, or a combination of the two.
If either or both of the given channels are blocking channels, then this method may block.
[中]独立于平台的通道到通道传输方法。使用常规读写操作将字节从源通道移动到接收器通道。在这个调用之后,应该检查ThroughBuffer是否有剩余的字节;如果存在,则应在继续之前将其写入接收器通道。此方法可用于NIO通道、XNIO通道或两者的组合。
如果给定通道中的一个或两个都是阻塞通道,则此方法可能会阻塞。
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(StreamSourceChannel streamSourceChannel, long l, ByteBuffer byteBuffer) throws IOException {
return IoUtils.transfer(streamSourceChannel, l, byteBuffer, fileChannel);
}
代码示例来源:origin: wildfly/wildfly
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
return IoUtils.transfer(source, count, throughBuffer, this);
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException {
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException {
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException {
return IoUtils.transfer(new ConduitReadableByteChannel(this), count, throughBuffer, target);
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException {
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
if (anyAreSet(state, FLAG_WRITES_SHUTDOWN)) {
throw new ClosedChannelException();
}
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
if (anyAreSet(state, FLAG_WRITES_SHUTDOWN)) {
throw new ClosedChannelException();
}
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException {
if(anyAreSet(state, FLAG_WRITE_SHUTDOWN)) {
throw new ClosedChannelException();
}
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
if (anyAreSet(state, FLAG_CLOSE_COMPLETE)) {
throw new ClosedChannelException();
}
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferTo(long count, ByteBuffer throughBuffer, StreamSinkChannel target) throws IOException {
if(anyAreSet(state, FLAG_READ_SHUTDOWN)) {
return -1;
}
return IoUtils.transfer(new ConduitReadableByteChannel(this), count, throughBuffer, target);
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException {
try {
return IoUtils.transfer(new ConduitReadableByteChannel(this), count, throughBuffer, target);
} catch (IOException | RuntimeException | Error e) {
IoUtils.safeClose(closeable);
throw e;
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
if (anyAreSet(state, SHUTDOWN | CLOSED)) {
throw new ClosedChannelException();
}
if (!performFlushIfRequired()) {
return 0;
}
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
代码示例来源:origin: wildfly/wildfly
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
try {
if (state != 0) {
return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
} else {
return next.transferFrom(source, count, throughBuffer);
}
} catch (IOException| RuntimeException | Error e) {
IoUtils.safeClose(connection);
throw e;
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException {
try {
return IoUtils.transfer(new ConduitReadableByteChannel(this), count, throughBuffer, target);
} catch (IOException | RuntimeException | Error e) {
IoUtils.safeClose(exchange.getConnection());
throw e;
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public long transferTo(long count, ByteBuffer throughBuffer, StreamSinkChannel target) throws IOException {
try {
return IoUtils.transfer(new ConduitReadableByteChannel(this), count, throughBuffer, target);
} catch (IOException | RuntimeException e) {
IoUtils.safeClose(exchange.getConnection());
throw e;
}
}
内容来源于网络,如有侵权,请联系作者删除!