static BytesRef make(final BytesRef surface, int docID, int payloadSep) throws IOException { int len = surface.length + MAX_DOC_ID_LEN_WITH_SEP; byte[] buffer = new byte[len]; ByteArrayDataOutput output = new ByteArrayDataOutput(buffer); output.writeBytes(surface.bytes, surface.length - surface.offset); output.writeByte((byte) payloadSep); output.writeVInt(docID); return new BytesRef(buffer, 0, output.getPosition()); } }
ByteArrayDataOutput bad = new ByteArrayDataOutput(header); bad.writeByte(ARCS_AS_FIXED_ARRAY); bad.writeVInt(nodeIn.numArcs); bad.writeVInt(maxBytesPerArc);
@Override protected void encode(ByteSequencesWriter writer, ByteArrayDataOutput output, byte[] buffer, BytesRef spare, long weight) throws IOException { if (spare.length + 5 >= buffer.length) { buffer = ArrayUtil.grow(buffer, spare.length + 5); } output.reset(buffer); output.writeBytes(spare.bytes, spare.offset, spare.length); output.writeByte((byte)0); // separator: not used, just for sort order output.writeInt(encodeWeight(weight)); writer.write(buffer, 0, output.getPosition()); }
private void writeDeltas(ByteArrayDataOutput out, int[] ints, int count) { int k = 0; try { if (formatVersion < 1) { for (int i = 0; i < count; i++) { k = ints[i] - k; out.writeByte((byte) (k & 0xff)); k = ints[i]; } } else { for (int i = 0; i < count; i++) { k = ints[i] - k; out.writeVInt(k); k = ints[i]; } } } catch (IOException e) { } // System.out.println ("after writeDeltas " + count + " pos=" + // bytes.position()); }
private void writeShortDeltas(ByteArrayDataOutput out, short[] shorts, int count) { int k = 0; try { if (formatVersion < 1) { for (int i = 0; i < count; i++) { k = shorts[i] - k; out.writeByte((byte) (k & 0xff)); k = shorts[i]; } } else { for (int i = 0; i < count; i++) { k = shorts[i] - k; out.writeVInt(k); k = shorts[i]; } } } catch (IOException e) { } }
ByteArrayDataOutput bad = new ByteArrayDataOutput(header); bad.writeByte(ARCS_AS_FIXED_ARRAY); bad.writeVInt(nodeIn.numArcs); bad.writeVInt(maxBytesPerArc);
ByteArrayDataOutput bad = new ByteArrayDataOutput(header); bad.writeByte(ARCS_AS_FIXED_ARRAY); bad.writeVInt(nodeIn.numArcs); bad.writeVInt(maxBytesPerArc);
ByteArrayDataOutput bad = new ByteArrayDataOutput(header); bad.writeByte(ARCS_AS_FIXED_ARRAY); bad.writeVInt(nodeIn.numArcs); bad.writeVInt(maxBytesPerArc);