@Override public Binary readBytes() { int prefixLength = prefixLengthReader.readInteger(); // This does not copy bytes Binary suffix = suffixReader.readBytes(); int length = prefixLength + suffix.length(); // We have to do this to materialize the output if (prefixLength != 0) { byte[] out = new byte[length]; System.arraycopy(previous.getBytes(), 0, out, 0, prefixLength); System.arraycopy(suffix.getBytes(), 0, out, prefixLength, suffix.length()); previous = Binary.fromByteArray(out); } else { previous = suffix; } return previous; }
public byte readByte() { int prefixLength = prefixLengthReader.readInteger(); // This does not copy bytes Binary suffix = suffixReader.readBytes(); // int length = prefixLength + suffix.length(); // System.out.println("////// "+prefixLength); // System.out.println("////// "+suffix.length()); // if(prefixLength!=1){ // System.out.println("111"); // } // We have to do this to materialize the output if (prefixLength != 0) { // byte[] out = new byte[length]; System.arraycopy(previous.getBytes(), 0, out, 0, prefixLength); System.arraycopy(suffix.getBytes(), 0, out, prefixLength, suffix.length()); previous = Binary.fromByteArray(out); } else { previous = suffix; } return previous.getBytes()[0]; }
@Override public void skip() { prefixLengthReader.skip(); suffixReader.skip(); }
@Override public void initFromPage(int valueCount, byte[] page, int offset) throws IOException { prefixLengthReader.initFromPage(valueCount, page, offset); int next = prefixLengthReader.getNextOffset(); suffixReader.initFromPage(valueCount, page, next); }