/** * Writes a byte array. * <p> * The length is written as a <code>short</code>, followed * by the bytes. */ public void write(byte[] bytes, int off, int len) throws IOException { assert bytes != null; assert off >= 0 && off + len <= bytes.length; assert len >= 0; if (len > Short.MAX_VALUE) { throw new IllegalArgumentException("len must be <= " + Short.MAX_VALUE + "; got " + len); } out.writeShort((short) len); out.writeBytes(bytes, off, len); }
private static void flush(int block, FixedBitSet buffer, int cardinality, IndexOutput out) throws IOException { assert block >= 0 && block < 65536; out.writeShort((short) block); assert cardinality > 0 && cardinality <= 65536; out.writeShort((short) (cardinality - 1)); if (cardinality > MAX_ARRAY_LENGTH) { if (cardinality != 65536) { // all docs are set for (long word : buffer.getBits()) { out.writeLong(word); } } } else { BitSetIterator it = new BitSetIterator(buffer, cardinality); for (int doc = it.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = it.nextDoc()) { out.writeShort((short) doc); } } }
private void writeValues(NumericDocValues values, int numBytesPerValue, IndexOutput out) throws IOException, AssertionError { for (int doc = values.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = values.nextDoc()) { long value = values.longValue(); switch (numBytesPerValue) { case 1: out.writeByte((byte) value); break; case 2: out.writeShort((short) value); break; case 4: out.writeInt((int) value); break; case 8: out.writeLong(value); break; default: throw new AssertionError(); } } } }
@Override public void writeShort(short i) throws IOException { delegate.writeShort( i ); }
/** * Writes a byte array. * <p> * The length is written as a <code>short</code>, followed * by the bytes. */ public void write(byte[] bytes, int off, int len) throws IOException { assert bytes != null; assert off >= 0 && off + len <= bytes.length; assert len >= 0; if (len > Short.MAX_VALUE) { throw new IllegalArgumentException("len must be <= " + Short.MAX_VALUE + "; got " + len); } out.writeShort((short) len); out.writeBytes(bytes, off, len); }
private static void flush(int block, FixedBitSet buffer, int cardinality, IndexOutput out) throws IOException { assert block >= 0 && block < 65536; out.writeShort((short) block); assert cardinality > 0 && cardinality <= 65536; out.writeShort((short) (cardinality - 1)); if (cardinality > MAX_ARRAY_LENGTH) { if (cardinality != 65536) { // all docs are set for (long word : buffer.getBits()) { out.writeLong(word); } } } else { BitSetIterator it = new BitSetIterator(buffer, cardinality); for (int doc = it.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = it.nextDoc()) { out.writeShort((short) doc); } } }
private void addByte2(Iterable<Number> values) throws IOException { meta.writeByte((byte) 2); meta.writeLong(data.getFilePointer()); for (Number value : values) { data.writeShort(value.shortValue()); } }
private void addByte2(Iterable<Number> values) throws IOException { meta.writeByte((byte) 2); meta.writeLong(data.getFilePointer()); for (Number value : values) { data.writeShort(value.shortValue()); } }
private void writeValues(NumericDocValues values, int numBytesPerValue, IndexOutput out) throws IOException, AssertionError { for (int doc = values.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = values.nextDoc()) { long value = values.longValue(); switch (numBytesPerValue) { case 1: out.writeByte((byte) value); break; case 2: out.writeShort((short) value); break; case 4: out.writeInt((int) value); break; case 8: out.writeLong(value); break; default: throw new AssertionError(); } } } }
break; case 2: data.writeShort((short) v); break; case 4: