/** * Reads the next byteWidth little endian int. */ private int readIntLittleEndianPaddedOnBitWidth() { switch (bytesWidth) { case 0: return 0; case 1: return in[offset++] & 255; case 2: { int ch2 = in[offset] & 255; int ch1 = in[offset + 1] & 255; offset += 2; return (ch1 << 8) + ch2; } case 3: { int ch3 = in[offset] & 255; int ch2 = in[offset + 1] & 255; int ch1 = in[offset + 2] & 255; offset += 3; return (ch1 << 16) + (ch2 << 8) + (ch3 << 0); } case 4: { return readIntLittleEndian(); } } throw new RuntimeException("Unreachable"); }
@Override public void initFromPage(int valueCount, byte[] page, int start) { this.offset = start; this.in = page; if (fixedWidth) { if (bitWidth != 0) { int length = readIntLittleEndian(); this.end = this.offset + length; } } else { this.end = page.length; if (this.end != this.offset) init(page[this.offset++] & 255); } if (bitWidth == 0) { // 0 bit width, treat this as an RLE run of valueCount number of 0's. this.mode = MODE.RLE; this.currentCount = valueCount; this.currentValue = 0; } else { this.currentCount = 0; } }
@Override public void initFromPage(int valueCount, ByteBufferInputStream in) throws IOException { this.in = in; if (fixedWidth) { // initialize for repetition and definition levels if (readLength) { int length = readIntLittleEndian(); this.in = in.sliceStream(length); } } else { // initialize for values if (in.available() > 0) { init(in.read()); } } if (bitWidth == 0) { // 0 bit width, treat this as an RLE run of valueCount number of 0's. this.mode = MODE.RLE; this.currentCount = valueCount; this.currentValue = 0; } else { this.currentCount = 0; } }
@Override public void initFromPage(int valueCount, ByteBufferInputStream in) throws IOException { this.in = in; if (fixedWidth) { // initialize for repetition and definition levels if (readLength) { int length = readIntLittleEndian(); this.in = in.sliceStream(length); } } else { // initialize for values if (in.available() > 0) { init(in.read()); } } if (bitWidth == 0) { // 0 bit width, treat this as an RLE run of valueCount number of 0's. this.mode = MODE.RLE; this.currentCount = valueCount; this.currentValue = 0; } else { this.currentCount = 0; } }
/** * Reads the next byteWidth little endian int. */ private int readIntLittleEndianPaddedOnBitWidth() throws IOException { switch (bytesWidth) { case 0: return 0; case 1: return in.read(); case 2: { int ch2 = in.read(); int ch1 = in.read(); return (ch1 << 8) + ch2; } case 3: { int ch3 = in.read(); int ch2 = in.read(); int ch1 = in.read(); return (ch1 << 16) + (ch2 << 8) + (ch3 << 0); } case 4: { return readIntLittleEndian(); } } throw new RuntimeException("Unreachable"); }
/** * Reads the next byteWidth little endian int. */ private int readIntLittleEndianPaddedOnBitWidth() throws IOException { switch (bytesWidth) { case 0: return 0; case 1: return in.read(); case 2: { int ch2 = in.read(); int ch1 = in.read(); return (ch1 << 8) + ch2; } case 3: { int ch3 = in.read(); int ch2 = in.read(); int ch1 = in.read(); return (ch1 << 16) + (ch2 << 8) + (ch3 << 0); } case 4: { return readIntLittleEndian(); } } throw new RuntimeException("Unreachable"); }
/** * Reads the next byteWidth little endian int. */ private int readIntLittleEndianPaddedOnBitWidth() { switch (bytesWidth) { case 0: return 0; case 1: return in[offset++] & 255; case 2: { int ch2 = in[offset] & 255; int ch1 = in[offset + 1] & 255; offset += 2; return (ch1 << 8) + ch2; } case 3: { int ch3 = in[offset] & 255; int ch2 = in[offset + 1] & 255; int ch1 = in[offset + 2] & 255; offset += 3; return (ch1 << 16) + (ch2 << 8) + (ch3 << 0); } case 4: { return readIntLittleEndian(); } } throw new RuntimeException("Unreachable"); }
@Override public void initFromPage(int valueCount, byte[] page, int start) { this.offset = start; this.in = page; if (fixedWidth) { if (bitWidth != 0) { int length = readIntLittleEndian(); this.end = this.offset + length; } } else { this.end = page.length; if (this.end != this.offset) init(page[this.offset++] & 255); } if (bitWidth == 0) { // 0 bit width, treat this as an RLE run of valueCount number of 0's. this.mode = MODE.RLE; this.currentCount = valueCount; this.currentValue = 0; } else { this.currentCount = 0; } }