private int writeByteBuffer(ByteBuffer byteBuffer) throws IOException { int written; int totalWritten = 0; do { written = this.channel.write(byteBuffer); totalWritten += written; } while (byteBuffer.hasRemaining() && written > 0); return totalWritten; }
private long doWrite(ByteBuffer[] srcs, int offset, int length, final boolean writeFinal) throws IOException { if(writeFinal) { return delegate.writeFinal(srcs, offset, length); } return delegate.write(srcs, offset, length); }
public int write(final ByteBuffer src) throws IOException { return sink.write(src); }
private int doWrite(ByteBuffer src, boolean finalWrite) throws IOException { if(finalWrite) { return delegate.writeFinal(src); } return delegate.write(src); }
public long write(final ByteBuffer[] srcs) throws IOException { return sink.write(srcs); }
private void writeBufferBlocking(final boolean writeFinal) throws IOException { if (channel == null) { channel = exchange.getResponseChannel(); } buffer.flip(); while (buffer.hasRemaining()) { if(writeFinal) { channel.writeFinal(buffer); } else { channel.write(buffer); } if(buffer.hasRemaining()) { channel.awaitWritable(); } } buffer.clear(); state |= FLAG_WRITE_STARTED; }
public int write(final ByteBuffer src) throws IOException { return delegate.write(src); }
public long write(final ByteBuffer[] srcs) throws IOException { return delegate.write(srcs); }
public long write(final ByteBuffer[] srcs, final int offs, final int len) throws IOException { return channel.write(srcs, offs, len); }
public long write(final ByteBuffer[] srcs, final int offset, final int length) throws IOException { return sink.write(srcs, offset, length); }
public int write(final ByteBuffer src) throws IOException { return channel.write(src); }
public long write(final ByteBuffer[] srcs, final int offset, final int length) throws IOException { return delegate.write(srcs, offset, length); }
private int writeByteBuffer(ByteBuffer byteBuffer) throws IOException { int written; int totalWritten = 0; do { written = this.channel.write(byteBuffer); totalWritten += written; } while (byteBuffer.hasRemaining() && written > 0); return totalWritten; }
/** * Writes out the data in the buffer to the channel. If all the data is written out * then the channel will have its writes shutdown. * * @param channel The channel * @param src The buffer * @return The number of bytes written * @throws IOException */ public static int writeFinalBasic(StreamSinkChannel channel, ByteBuffer src) throws IOException { int res = channel.write(src); if(!src.hasRemaining()) { channel.shutdownWrites(); } return res; }
@Override public long write(final ByteBuffer[] srcs) throws IOException { if (isFinished()) { throw UndertowMessages.MESSAGES.channelIsClosed(); } return delegate.write(srcs); }
@Override public long write(final ByteBuffer[] srcs, final int offset, final int length) throws IOException { if (isFinished()) { throw UndertowMessages.MESSAGES.channelIsClosed(); } return delegate.write(srcs, offset, length); }
@Override public int write(final ByteBuffer src) throws IOException { if (isFinished()) { throw UndertowMessages.MESSAGES.channelIsClosed(); } return delegate.write(src); }
@Override public void handleEvent(final StreamSinkChannel channel) { try { int c; do { c = channel.write(buffer); } while (buffer.hasRemaining() && c > 0); if (buffer.hasRemaining()) { channel.resumeWrites(); return; } else { writeDone(channel); } } catch (IOException e) { handleError(channel, e); } }
public void setup(final StreamSinkChannel channel) { try { int c; do { c = channel.write(buffer); } while (buffer.hasRemaining() && c > 0); if (buffer.hasRemaining()) { channel.getWriteSetter().set(this); channel.resumeWrites(); } else { writeDone(channel); } } catch (IOException e) { handleError(channel, e); } }
try { if (body != null) { result.getRequestChannel().write(ByteBuffer.wrap(body.getBytes()));