protected void readTimestamp(ByteBuffer in) { // used in subclasses to add timestamp to state ByteBufferUtils.skip(in, KeyValue.TIMESTAMP_SIZE); }
/** * Copy the data to the output stream and update position in buffer. * @param out the stream to write bytes to * @param in the buffer to read bytes from * @param length the number of bytes to copy */ public static void moveBufferToStream(OutputStream out, ByteBuffer in, int length) throws IOException { copyBufferToStream(out, in, in.position(), length); skip(in, length); }
/** * Copy the given number of bytes from the given stream and put it at the * current position of the given buffer, updating the position in the buffer. * @param out the buffer to write data to * @param in the stream to read data from * @param length the number of bytes to read/write */ public static void copyFromStreamToBuffer(ByteBuffer out, DataInputStream in, int length) throws IOException { if (out.hasArray()) { in.readFully(out.array(), out.position() + out.arrayOffset(), length); skip(out, length); } else { for (int i = 0; i < length; ++i) { out.put(in.readByte()); } } }
/** * Copy from one buffer to another from given offset. * <p> * Note : This will advance the position marker of {@code out} but not change the position maker * for {@code in} * @param in source buffer * @param out destination buffer * @param sourceOffset offset in the source buffer * @param length how many bytes to copy */ public static void copyFromBufferToBuffer(ByteBuffer in, ByteBuffer out, int sourceOffset, int length) { if (in.hasArray() && out.hasArray()) { System.arraycopy(in.array(), sourceOffset + in.arrayOffset(), out.array(), out.position() + out.arrayOffset(), length); skip(out, length); } else if (UNSAFE_AVAIL) { UnsafeAccess.copy(in, sourceOffset, out, out.position(), length); skip(out, length); } else { ByteBuffer inDup = in.duplicate(); inDup.position(sourceOffset).limit(sourceOffset + length); out.put(inDup); } }
ByteBufferUtils.skip(in, rowLength); ByteBufferUtils.skip(in, familyLength + qualifierLength); } else { rowLength = previousState.rowLength; qualifierLength = previousState.qualifierLength + keyLength - previousState.keyLength; ByteBufferUtils.skip(in, (KeyValue.ROW_LENGTH_SIZE + KeyValue.FAMILY_LENGTH_SIZE) + rowLength + familyLength + qualifierLength);
ByteBufferUtils.skip(buffer, -KeyValue.ROW_LENGTH_SIZE); rowLength = buffer.getShort(); rowRestLength = rowLength;
protected void readTimestamp(ByteBuffer in) { // used in subclasses to add timestamp to state ByteBufferUtils.skip(in, KeyValue.TIMESTAMP_SIZE); }
protected void readTimestamp(ByteBuffer in) { // used in subclasses to add timestamp to state ByteBufferUtils.skip(in, KeyValue.TIMESTAMP_SIZE); }
/** * Copy the data to the output stream and update position in buffer. * @param out the stream to write bytes to * @param in the buffer to read bytes from * @param length the number of bytes to copy */ public static void moveBufferToStream(OutputStream out, ByteBuffer in, int length) throws IOException { copyBufferToStream(out, in, in.position(), length); skip(in, length); }
@Override protected void decodeFirst() { ByteBufferUtils.skip(currentBuffer, Bytes.SIZEOF_INT); decodeNext(); } };
@Override protected void decodeFirst() { ByteBufferUtils.skip(currentBuffer, Bytes.SIZEOF_INT); current.lastCommonPrefix = 0; decodeNext(); } };
@Override protected void decodeFirst() { ByteBufferUtils.skip(currentBuffer, Bytes.SIZEOF_INT); // read column family byte familyNameLength = currentBuffer.get(); familyNameWithSize = new byte[familyNameLength + Bytes.SIZEOF_BYTE]; familyNameWithSize[0] = familyNameLength; currentBuffer.get(familyNameWithSize, Bytes.SIZEOF_BYTE, familyNameLength); decode(true); }
/** * Copy the data to the output stream and update position in buffer. * @param out the stream to write bytes to * @param in the buffer to read bytes from * @param length the number of bytes to copy */ public static void moveBufferToStream(OutputStream out, ByteBuffer in, int length) throws IOException { copyBufferToStream(out, in, in.position(), length); skip(in, length); }
@Override protected void decodeFirst() { ByteBufferUtils.skip(currentBuffer, Bytes.SIZEOF_INT); decode(true); }
@Override protected void decodeFirst() { ByteBufferUtils.skip(currentBuffer, Bytes.SIZEOF_INT); current.lastCommonPrefix = 0; decodeNext(); } };
@Override protected void decodeFirst() { ByteBufferUtils.skip(currentBuffer, Bytes.SIZEOF_INT); decode(true); }
/** * Copy the data to the output stream and update position in buffer. * @param out the stream to write bytes to * @param in the buffer to read bytes from * @param length the number of bytes to copy */ public static void moveBufferToStream(OutputStream out, ByteBuffer in, int length) throws IOException { copyBufferToStream(out, in, in.position(), length); skip(in, length); }