valueBufferInputStream = new ChunkDecoder(); valueDataInputStream = new DataInputStream(valueBufferInputStream);
/** * Writing the value to the output stream. This method avoids copying * value data from Scanner into user buffer, then writing to the output * stream. It does not require the value length to be known. * * @param out * The output stream * @return the length of the value * @throws IOException */ public long writeValue(OutputStream out) throws IOException { DataInputStream dis = getValueStream(); long size = 0; try { int chunkSize; while ((chunkSize = valueBufferInputStream.getRemain()) > 0) { chunkSize = Math.min(chunkSize, MAX_VAL_TRANSFER_BUF_SIZE); valTransferBuffer.setSize(chunkSize); dis.readFully(valTransferBuffer.getBytes(), 0, chunkSize); out.write(valTransferBuffer.getBytes(), 0, chunkSize); size += chunkSize; } return size; } finally { dis.close(); } }
valueBufferInputStream = new ChunkDecoder(); valueDataInputStream = new DataInputStream(valueBufferInputStream);
valueBufferInputStream = new ChunkDecoder(); valueDataInputStream = new DataInputStream(valueBufferInputStream);
valueBufferInputStream = new ChunkDecoder(); valueDataInputStream = new DataInputStream(valueBufferInputStream);
valueBufferInputStream = new ChunkDecoder(); valueDataInputStream = new DataInputStream(valueBufferInputStream);
valueBufferInputStream = new ChunkDecoder(); valueDataInputStream = new DataInputStream(valueBufferInputStream);
valueBufferInputStream = new ChunkDecoder(); valueDataInputStream = new DataInputStream(valueBufferInputStream);
/** * Writing the value to the output stream. This method avoids copying * value data from Scanner into user buffer, then writing to the output * stream. It does not require the value length to be known. * * @param out * The output stream * @return the length of the value * @throws IOException */ public long writeValue(OutputStream out) throws IOException { DataInputStream dis = getValueStream(); long size = 0; try { int chunkSize; while ((chunkSize = valueBufferInputStream.getRemain()) > 0) { chunkSize = Math.min(chunkSize, MAX_VAL_TRANSFER_BUF_SIZE); valTransferBuffer.setSize(chunkSize); dis.readFully(valTransferBuffer.getBytes(), 0, chunkSize); out.write(valTransferBuffer.getBytes(), 0, chunkSize); size += chunkSize; } return size; } finally { dis.close(); } }
/** * Writing the value to the output stream. This method avoids copying * value data from Scanner into user buffer, then writing to the output * stream. It does not require the value length to be known. * * @param out * The output stream * @return the length of the value * @throws IOException */ public long writeValue(OutputStream out) throws IOException { DataInputStream dis = getValueStream(); long size = 0; try { int chunkSize; while ((chunkSize = valueBufferInputStream.getRemain()) > 0) { chunkSize = Math.min(chunkSize, MAX_VAL_TRANSFER_BUF_SIZE); valTransferBuffer.setSize(chunkSize); dis.readFully(valTransferBuffer.getBytes(), 0, chunkSize); out.write(valTransferBuffer.getBytes(), 0, chunkSize); size += chunkSize; } return size; } finally { dis.close(); } }
/** * Writing the value to the output stream. This method avoids copying * value data from Scanner into user buffer, then writing to the output * stream. It does not require the value length to be known. * * @param out * The output stream * @return the length of the value * @throws IOException */ public long writeValue(OutputStream out) throws IOException { DataInputStream dis = getValueStream(); long size = 0; try { int chunkSize; while ((chunkSize = valueBufferInputStream.getRemain()) > 0) { chunkSize = Math.min(chunkSize, MAX_VAL_TRANSFER_BUF_SIZE); valTransferBuffer.setSize(chunkSize); dis.readFully(valTransferBuffer.get(), 0, chunkSize); out.write(valTransferBuffer.get(), 0, chunkSize); size += chunkSize; } return size; } finally { dis.close(); } }
/** * Writing the value to the output stream. This method avoids copying * value data from Scanner into user buffer, then writing to the output * stream. It does not require the value length to be known. * * @param out * The output stream * @return the length of the value * @throws IOException */ public long writeValue(OutputStream out) throws IOException { DataInputStream dis = getValueStream(); long size = 0; try { int chunkSize; while ((chunkSize = valueBufferInputStream.getRemain()) > 0) { chunkSize = Math.min(chunkSize, MAX_VAL_TRANSFER_BUF_SIZE); valTransferBuffer.setSize(chunkSize); dis.readFully(valTransferBuffer.getBytes(), 0, chunkSize); out.write(valTransferBuffer.getBytes(), 0, chunkSize); size += chunkSize; } return size; } finally { dis.close(); } }
/** * Copy the value into BytesWritable. The input BytesWritable will be * automatically resized to the actual value size. The implementation * directly uses the buffer inside BytesWritable for storing the value. * The call does not require the value length to be known. * * @param value * @throws IOException */ public long getValue(BytesWritable value) throws IOException { DataInputStream dis = getValueStream(); int size = 0; try { int remain; while ((remain = valueBufferInputStream.getRemain()) > 0) { value.setSize(size + remain); dis.readFully(value.getBytes(), size, remain); size += remain; } return value.getLength(); } finally { dis.close(); } }