@Override public void finish() throws IOException { if (inputOffset > 0) { writeNextChunk(inputBuffer, 0, this.inputOffset); } }
@Override public void write(int b) throws IOException { inputBuffer[inputOffset++] = (byte) b; if (inputOffset >= inputMaxSize) { writeNextChunk(inputBuffer, 0, this.inputOffset); } }
@Override public void write(int b) throws IOException { inputBuffer[inputOffset++] = (byte) b; if (inputOffset >= inputMaxSize) { writeNextChunk(inputBuffer, 0, this.inputOffset); } }
@Override public void finish() throws IOException { if (inputOffset > 0) { writeNextChunk(inputBuffer, 0, this.inputOffset); } }
@Override public void write(byte[] buffer, int offset, int length) throws IOException { while (length > 0) { int chunkSize = Math.min(length, inputMaxSize - inputOffset); // favor writing directly from the user buffer to avoid the extra copy if (inputOffset == 0 && length > inputMaxSize) { writeNextChunk(buffer, offset, chunkSize); } else { System.arraycopy(buffer, offset, inputBuffer, inputOffset, chunkSize); inputOffset += chunkSize; if (inputOffset >= inputMaxSize) { writeNextChunk(inputBuffer, 0, inputOffset); } } length -= chunkSize; offset += chunkSize; } }
@Override public void write(byte[] buffer, int offset, int length) throws IOException { while (length > 0) { int chunkSize = Math.min(length, inputMaxSize - inputOffset); // favor writing directly from the user buffer to avoid the extra copy if (inputOffset == 0 && length > inputMaxSize) { writeNextChunk(buffer, offset, chunkSize); } else { System.arraycopy(buffer, offset, inputBuffer, inputOffset, chunkSize); inputOffset += chunkSize; if (inputOffset >= inputMaxSize) { writeNextChunk(inputBuffer, 0, inputOffset); } } length -= chunkSize; offset += chunkSize; } }