private byte readNextByte(Position readPos) { // This method is inefficient. It's only used when something crosses buffer boundaries. ponderNextBufferToRead(readPos); return readPos.buffer[readPos.offset++]; }
public void skipVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte); if (length > 1) { readPos.offset += (length - 1); } int diff = readPos.offset - wbSize; while (diff >= 0) { ++readPos.bufferIndex; readPos.buffer = writeBuffers.get(readPos.bufferIndex); readPos.offset = diff; diff = readPos.offset - wbSize; } }
public int hashCode(long offset, int length, Position readPos) { setReadPoint(offset, readPos); if (isAllInOneReadBuffer(length, readPos)) { int result = HashCodeUtil.murmurHash(readPos.buffer, readPos.offset, length); readPos.offset += length; return result; } // Rare case of buffer boundary. Unfortunately we'd have to copy some bytes. byte[] bytes = new byte[length]; int destOffset = 0; while (destOffset < length) { ponderNextBufferToRead(readPos); int toRead = Math.min(length - destOffset, wbSize - readPos.offset); System.arraycopy(readPos.buffer, readPos.offset, bytes, destOffset, toRead); readPos.offset += toRead; destOffset += toRead; } return HashCodeUtil.murmurHash(bytes, 0, bytes.length); }
public long readVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte) - 1; if (length == 0) { return firstByte; } long i = 0; if (isAllInOneReadBuffer(length, readPos)) { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readPos.buffer[readPos.offset + idx] & 0xFF); } readPos.offset += length; } else { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readNextByte(readPos) & 0xFF); } } return (WritableUtils.isNegativeVInt(firstByte) ? (i ^ -1L) : i); }
private byte readNextByte(Position readPos) { // This method is inefficient. It's only used when something crosses buffer boundaries. ponderNextBufferToRead(readPos); return readPos.buffer[readPos.offset++]; }
private byte readNextByte(Position readPos) { // This method is inefficient. It's only used when something crosses buffer boundaries. ponderNextBufferToRead(readPos); return readPos.buffer[readPos.offset++]; }
private byte readNextByte(Position readPos) { // This method is inefficient. It's only used when something crosses buffer boundaries. ponderNextBufferToRead(readPos); return readPos.buffer[readPos.offset++]; }
private byte readNextByte(Position readPos) { // This method is inefficient. It's only used when something crosses buffer boundaries. ponderNextBufferToRead(readPos); return readPos.buffer[readPos.offset++]; }
public void skipVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte); if (length > 1) { readPos.offset += (length - 1); } int diff = readPos.offset - wbSize; while (diff >= 0) { ++readPos.bufferIndex; readPos.buffer = writeBuffers.get(readPos.bufferIndex); readPos.offset = diff; diff = readPos.offset - wbSize; } }
public void skipVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte); if (length > 1) { readPos.offset += (length - 1); } int diff = readPos.offset - wbSize; while (diff >= 0) { ++readPos.bufferIndex; readPos.buffer = writeBuffers.get(readPos.bufferIndex); readPos.offset = diff; diff = readPos.offset - wbSize; } }
public void skipVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte); if (length > 1) { readPos.offset += (length - 1); } int diff = readPos.offset - wbSize; while (diff >= 0) { ++readPos.bufferIndex; readPos.buffer = writeBuffers.get(readPos.bufferIndex); readPos.offset = diff; diff = readPos.offset - wbSize; } }
public void skipVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte); if (length > 1) { readPos.offset += (length - 1); } int diff = readPos.offset - wbSize; while (diff >= 0) { ++readPos.bufferIndex; readPos.buffer = writeBuffers.get(readPos.bufferIndex); readPos.offset = diff; diff = readPos.offset - wbSize; } }
public int hashCode(long offset, int length, Position readPos) { setReadPoint(offset, readPos); if (isAllInOneReadBuffer(length, readPos)) { int result = HashCodeUtil.murmurHash(readPos.buffer, readPos.offset, length); readPos.offset += length; return result; } // Rare case of buffer boundary. Unfortunately we'd have to copy some bytes. byte[] bytes = new byte[length]; int destOffset = 0; while (destOffset < length) { ponderNextBufferToRead(readPos); int toRead = Math.min(length - destOffset, wbSize - readPos.offset); System.arraycopy(readPos.buffer, readPos.offset, bytes, destOffset, toRead); readPos.offset += toRead; destOffset += toRead; } return HashCodeUtil.murmurHash(bytes, 0, bytes.length); }
public int hashCode(long offset, int length, Position readPos) { setReadPoint(offset, readPos); if (isAllInOneReadBuffer(length, readPos)) { int result = murmurHash(readPos.buffer, readPos.offset, length); readPos.offset += length; return result; } // Rare case of buffer boundary. Unfortunately we'd have to copy some bytes. byte[] bytes = new byte[length]; int destOffset = 0; while (destOffset < length) { ponderNextBufferToRead(readPos); int toRead = Math.min(length - destOffset, wbSize - readPos.offset); System.arraycopy(readPos.buffer, readPos.offset, bytes, destOffset, toRead); readPos.offset += toRead; destOffset += toRead; } return murmurHash(bytes, 0, bytes.length); }
public int hashCode(long offset, int length, Position readPos) { setReadPoint(offset, readPos); if (isAllInOneReadBuffer(length, readPos)) { int result = murmurHash(readPos.buffer, readPos.offset, length); readPos.offset += length; return result; } // Rare case of buffer boundary. Unfortunately we'd have to copy some bytes. byte[] bytes = new byte[length]; int destOffset = 0; while (destOffset < length) { ponderNextBufferToRead(readPos); int toRead = Math.min(length - destOffset, wbSize - readPos.offset); System.arraycopy(readPos.buffer, readPos.offset, bytes, destOffset, toRead); readPos.offset += toRead; destOffset += toRead; } return murmurHash(bytes, 0, bytes.length); }
public int hashCode(long offset, int length, Position readPos) { setReadPoint(offset, readPos); if (isAllInOneReadBuffer(length, readPos)) { int result = murmurHash(readPos.buffer, readPos.offset, length); readPos.offset += length; return result; } // Rare case of buffer boundary. Unfortunately we'd have to copy some bytes. byte[] bytes = new byte[length]; int destOffset = 0; while (destOffset < length) { ponderNextBufferToRead(readPos); int toRead = Math.min(length - destOffset, wbSize - readPos.offset); System.arraycopy(readPos.buffer, readPos.offset, bytes, destOffset, toRead); readPos.offset += toRead; destOffset += toRead; } return murmurHash(bytes, 0, bytes.length); }
public long readVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte) - 1; if (length == 0) { return firstByte; } long i = 0; if (isAllInOneReadBuffer(length, readPos)) { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readPos.buffer[readPos.offset + idx] & 0xFF); } readPos.offset += length; } else { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readNextByte(readPos) & 0xFF); } } return (WritableUtils.isNegativeVInt(firstByte) ? (i ^ -1L) : i); }
public long readVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte) - 1; if (length == 0) { return firstByte; } long i = 0; if (isAllInOneReadBuffer(length, readPos)) { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readPos.buffer[readPos.offset + idx] & 0xFF); } readPos.offset += length; } else { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readNextByte(readPos) & 0xFF); } } return (WritableUtils.isNegativeVInt(firstByte) ? (i ^ -1L) : i); }
public long readVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte) - 1; if (length == 0) { return firstByte; } long i = 0; if (isAllInOneReadBuffer(length, readPos)) { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readPos.buffer[readPos.offset + idx] & 0xFF); } readPos.offset += length; } else { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readNextByte(readPos) & 0xFF); } } return (WritableUtils.isNegativeVInt(firstByte) ? (i ^ -1L) : i); }
public long readVLong(Position readPos) { ponderNextBufferToRead(readPos); byte firstByte = readPos.buffer[readPos.offset++]; int length = (byte) WritableUtils.decodeVIntSize(firstByte) - 1; if (length == 0) { return firstByte; } long i = 0; if (isAllInOneReadBuffer(length, readPos)) { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readPos.buffer[readPos.offset + idx] & 0xFF); } readPos.offset += length; } else { for (int idx = 0; idx < length; idx++) { i = (i << 8) | (readNextByte(readPos) & 0xFF); } } return (WritableUtils.isNegativeVInt(firstByte) ? (i ^ -1L) : i); }