@Override public void write(ByteBuffer toWrite) throws IOException { if (toWrite.hasArray()) { write(toWrite.array(), toWrite.arrayOffset() + toWrite.position(), toWrite.remaining()); } else { assert toWrite.isDirect(); MemoryUtil.duplicateDirectByteBuffer(toWrite, hollowBuffer); int toWriteRemaining = toWrite.remaining(); if (toWriteRemaining > buffer.remaining()) { if (strictFlushing) { writeExcessSlow(); } else { doFlush(toWriteRemaining - buffer.remaining()); while (hollowBuffer.remaining() > buffer.capacity()) channel.write(hollowBuffer); } } buffer.put(hollowBuffer); } }
@Override public void write(ByteBuffer toWrite) throws IOException { if (toWrite.hasArray()) { write(toWrite.array(), toWrite.arrayOffset() + toWrite.position(), toWrite.remaining()); } else { assert toWrite.isDirect(); MemoryUtil.duplicateDirectByteBuffer(toWrite, hollowBuffer); int toWriteRemaining = toWrite.remaining(); if (toWriteRemaining > buffer.remaining()) { if (strictFlushing) { writeExcessSlow(); } else { doFlush(toWriteRemaining - buffer.remaining()); while (hollowBuffer.remaining() > buffer.capacity()) channel.write(hollowBuffer); } } buffer.put(hollowBuffer); } }
@Override public void write(ByteBuffer toWrite) throws IOException { if (toWrite.hasArray()) { write(toWrite.array(), toWrite.arrayOffset() + toWrite.position(), toWrite.remaining()); } else { assert toWrite.isDirect(); MemoryUtil.duplicateDirectByteBuffer(toWrite, hollowBuffer); int toWriteRemaining = toWrite.remaining(); if (toWriteRemaining > buffer.remaining()) { if (strictFlushing) { writeExcessSlow(); } else { doFlush(toWriteRemaining - buffer.remaining()); while (hollowBuffer.remaining() > buffer.capacity()) channel.write(hollowBuffer); } } buffer.put(hollowBuffer); } }
@Override public void write(ByteBuffer toWrite) throws IOException { if (toWrite.hasArray()) { write(toWrite.array(), toWrite.arrayOffset() + toWrite.position(), toWrite.remaining()); } else { assert toWrite.isDirect(); MemoryUtil.duplicateDirectByteBuffer(toWrite, hollowBuffer); int toWriteRemaining = toWrite.remaining(); if (toWriteRemaining > buffer.remaining()) { if (strictFlushing) { writeExcessSlow(); } else { doFlush(toWriteRemaining - buffer.remaining()); while (hollowBuffer.remaining() > buffer.capacity()) channel.write(hollowBuffer); } } buffer.put(hollowBuffer); } }