public long readNByteLong(int bytes, Position readPos) { long v = 0; if (isAllInOneReadBuffer(bytes, readPos)) { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readPos.buffer[readPos.offset + i] & 0xff); } readPos.offset += bytes; } else { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readNextByte(readPos) & 0xff); } } return v; }
public int readInt(long offset, Position readPos) { setReadPoint(offset, readPos); long v = 0; if (isAllInOneReadBuffer(4, readPos)) { for (int i = 0; i < 4; ++i) { v = (v << 8) + (readPos.buffer[readPos.offset + i] & 0xff); } readPos.offset += 4; } else { for (int i = 0; i < 4; ++i) { v = (v << 8) + (readNextByte(readPos) & 0xff); } } return (int) v; }
public long readNByteLong(long offset, int bytes, Position readPos) { setReadPoint(offset, readPos); long v = 0; if (isAllInOneReadBuffer(bytes, readPos)) { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readPos.buffer[readPos.offset + i] & 0xff); } readPos.offset += bytes; } else { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readNextByte(readPos) & 0xff); } } return v; }
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); }
public long readNByteLong(long offset, int bytes, Position readPos) { setReadPoint(offset, readPos); long v = 0; if (isAllInOneReadBuffer(bytes, readPos)) { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readPos.buffer[readPos.offset + i] & 0xff); } readPos.offset += bytes; } else { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readNextByte(readPos) & 0xff); } } return v; }
public long readNByteLong(long offset, int bytes, Position readPos) { setReadPoint(offset, readPos); long v = 0; if (isAllInOneReadBuffer(bytes, readPos)) { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readPos.buffer[readPos.offset + i] & 0xff); } readPos.offset += bytes; } else { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readNextByte(readPos) & 0xff); } } return v; }
public long readNByteLong(long offset, int bytes, Position readPos) { setReadPoint(offset, readPos); long v = 0; if (isAllInOneReadBuffer(bytes, readPos)) { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readPos.buffer[readPos.offset + i] & 0xff); } readPos.offset += bytes; } else { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readNextByte(readPos) & 0xff); } } return v; }
public long readNByteLong(long offset, int bytes, Position readPos) { setReadPoint(offset, readPos); long v = 0; if (isAllInOneReadBuffer(bytes, readPos)) { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readPos.buffer[readPos.offset + i] & 0xff); } readPos.offset += bytes; } else { for (int i = 0; i < bytes; ++i) { v = (v << 8) + (readNextByte(readPos) & 0xff); } } return v; }
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 = 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 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); }