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 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 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 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 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); }