Java Code Examples for org.xnio.IoUtils#transfer()

The following examples show how to use org.xnio.IoUtils#transfer() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SslConduit.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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);
}
 
Example 2
Source File: AjpServerRequestConduit.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
    }
}
 
Example 3
Source File: PreChunkedStreamSinkConduit.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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));
}
 
Example 4
Source File: InflatingStreamSourceConduit.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
    }
}
 
Example 5
Source File: HttpResponseConduit.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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;
    }
}
 
Example 6
Source File: DeflatingStreamSinkConduit.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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));
}
 
Example 7
Source File: HeadStreamSinkConduit.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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));
}
 
Example 8
Source File: ChunkedStreamSourceConduit.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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;
    }
}
 
Example 9
Source File: ChunkedStreamSinkConduit.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@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));
}
 
Example 10
Source File: DebuggingStreamSourceConduit.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException {
    return IoUtils.transfer(new ConduitReadableByteChannel(this), count, throughBuffer, target);
}
 
Example 11
Source File: RangeStreamSinkConduit.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public long transferFrom(StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException {
    return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
 
Example 12
Source File: DebuggingStreamSinkConduit.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
    return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
 
Example 13
Source File: ReadDataStreamSourceConduit.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public long transferTo(final long count, final ByteBuffer throughBuffer, final StreamSinkChannel target) throws IOException {
    return IoUtils.transfer(new ConduitReadableByteChannel(this), count, throughBuffer, target);
}
 
Example 14
Source File: AbstractFramedStreamSinkConduit.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
    return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
 
Example 15
Source File: StoredResponseStreamSinkConduit.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public long transferFrom(StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException {
    return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
 
Example 16
Source File: ResponseCachingStreamSinkConduit.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
    return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
 
Example 17
Source File: ContentEncodedResourceManager.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public long transferFrom(StreamSourceChannel streamSourceChannel, long l, ByteBuffer byteBuffer) throws IOException {
    return IoUtils.transfer(streamSourceChannel, l, byteBuffer, fileChannel);
}
 
Example 18
Source File: AbstractFramedStreamSinkChannel.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
    return IoUtils.transfer(source, count, throughBuffer, this);
}
 
Example 19
Source File: PipeliningBufferingStreamSinkConduit.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public long transferFrom(StreamSourceChannel source, long count, ByteBuffer throughBuffer) throws IOException {
    return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}
 
Example 20
Source File: AjpServerResponseConduit.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public long transferFrom(final StreamSourceChannel source, final long count, final ByteBuffer throughBuffer) throws IOException {
    return IoUtils.transfer(source, count, throughBuffer, new ConduitWritableByteChannel(this));
}