public ByteBufferListOutputStream(ByteBufferPool pool) { this.pool = pool; allocateNewBuffer(); }
@Override protected void checkSizeAndGrow(int extra) { long capacityNeeded = curBuf.position() + (long) extra; if (capacityNeeded > curBuf.limit()) { allocateNewBuffer(); } }
@Override public void write(byte[] b, int off, int len) throws IOException { int toWrite = 0; while (len > 0) { toWrite = Math.min(len, this.curBuf.remaining()); ByteBufferUtils.copyFromArrayToBuffer(this.curBuf, b, off, toWrite); off += toWrite; len -= toWrite; if (len > 0) { allocateNewBuffer();// The curBuf is over. Let us move to the next one } } }
@Override public void write(ByteBuffer b, int off, int len) throws IOException { int toWrite = 0; while (len > 0) { toWrite = Math.min(len, this.curBuf.remaining()); ByteBufferUtils.copyFromBufferToBuffer(b, this.curBuf, off, toWrite); off += toWrite; len -= toWrite; if (len > 0) { allocateNewBuffer();// The curBuf is over. Let us move to the next one } } } }
public ByteBufferListOutputStream(ByteBufferPool pool) { this.pool = pool; allocateNewBuffer(); }
public ByteBufferListOutputStream(ByteBufferPool pool) { this.pool = pool; allocateNewBuffer(); }
@Override protected void checkSizeAndGrow(int extra) { long capacityNeeded = curBuf.position() + (long) extra; if (capacityNeeded > curBuf.limit()) { allocateNewBuffer(); } }
@Override protected void checkSizeAndGrow(int extra) { long capacityNeeded = curBuf.position() + (long) extra; if (capacityNeeded > curBuf.limit()) { allocateNewBuffer(); } }
@Override public void write(byte[] b, int off, int len) throws IOException { int toWrite = 0; while (len > 0) { toWrite = Math.min(len, this.curBuf.remaining()); ByteBufferUtils.copyFromArrayToBuffer(this.curBuf, b, off, toWrite); off += toWrite; len -= toWrite; if (len > 0) { allocateNewBuffer();// The curBuf is over. Let us move to the next one } } }
@Override public void write(ByteBuffer b, int off, int len) throws IOException { int toWrite = 0; while (len > 0) { toWrite = Math.min(len, this.curBuf.remaining()); ByteBufferUtils.copyFromBufferToBuffer(b, this.curBuf, off, toWrite); off += toWrite; len -= toWrite; if (len > 0) { allocateNewBuffer();// The curBuf is over. Let us move to the next one } } } }
@Override public void write(byte[] b, int off, int len) throws IOException { int toWrite = 0; while (len > 0) { toWrite = Math.min(len, this.curBuf.remaining()); ByteBufferUtils.copyFromArrayToBuffer(this.curBuf, b, off, toWrite); off += toWrite; len -= toWrite; if (len > 0) { allocateNewBuffer();// The curBuf is over. Let us move to the next one } } }
@Override public void write(ByteBuffer b, int off, int len) throws IOException { int toWrite = 0; while (len > 0) { toWrite = Math.min(len, this.curBuf.remaining()); ByteBufferUtils.copyFromBufferToBuffer(b, this.curBuf, off, toWrite); off += toWrite; len -= toWrite; if (len > 0) { allocateNewBuffer();// The curBuf is over. Let us move to the next one } } } }