Java Code Examples for org.apache.lucene.store.DataInput#skipBytes()

The following examples show how to use org.apache.lucene.store.DataInput#skipBytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FSTTermOutputs.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Override
public void skipOutput(DataInput in) throws IOException {
  int bits = in.readByte() & 0xff;
  int bit0 = bits & 1;
  int bit1 = bits & 2;
  int bytesSize = (bits >>> 2);
  if (bit0 > 0 && bytesSize == 0) {  // determine extra length
    bytesSize = in.readVInt();
  }
  if (bit0 > 0) {  // bytes exists
    in.skipBytes(bytesSize);
  }
  if (bit1 > 0) {  // stats exist
    int code = in.readVInt();
    if (hasPos && (code & 1) == 0) {
      in.readVLong();
    }
  }
}
 
Example 2
Source File: CompressingStoredFieldsReader.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
private static void skipField(DataInput in, int bits) throws IOException {
  switch (bits & TYPE_MASK) {
    case BYTE_ARR:
    case STRING:
      final int length = in.readVInt();
      in.skipBytes(length);
      break;
    case NUMERIC_INT:
      in.readZInt();
      break;
    case NUMERIC_FLOAT:
      readZFloat(in);
      break;
    case NUMERIC_LONG:
      readTLong(in);
      break;
    case NUMERIC_DOUBLE:
      readZDouble(in);
      break;
    default:
      throw new AssertionError("Unknown type flag: " + Integer.toHexString(bits));
  }
}
 
Example 3
Source File: FSTOrdsOutputs.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public void skipOutput(DataInput in) throws IOException {
  int len = in.readVInt();
  in.skipBytes(len);
  in.readVLong();
  in.readVLong();
}
 
Example 4
Source File: Rot13CypherTestUtil.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public static byte[] decode(DataInput bytesInput, long length) throws IOException {
  length -= ENCODING_OFFSET;
  bytesInput.skipBytes(ENCODING_OFFSET);
  byte[] decodedBytes = new byte[Math.toIntExact(length)];
  for (int i = 0; i < length; i++) {
    decodedBytes[i] = (byte)(bytesInput.readByte() - ENCODING_ROTATION);
  }
  return decodedBytes;
}
 
Example 5
Source File: PForUtil.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * Skip 128 integers.
 */
void skip(DataInput in) throws IOException {
  final int token = Byte.toUnsignedInt(in.readByte());
  final int bitsPerValue = token & 0x1f;
  final int numExceptions = token >>> 5;
  if (bitsPerValue == 0) {
    in.readVLong();
    in.skipBytes((numExceptions << 1));
  } else {
    in.skipBytes(forUtil.numBytes(bitsPerValue) + (numExceptions << 1));
  }
}
 
Example 6
Source File: ForDeltaUtil.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * Skip a sequence of 128 longs.
 */
void skip(DataInput in) throws IOException {
  final int bitsPerValue = Byte.toUnsignedInt(in.readByte());
  if (bitsPerValue != 0) {
    in.skipBytes(forUtil.numBytes(bitsPerValue));
  }
}
 
Example 7
Source File: ByteSequenceOutputs.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
@Override
public void skipOutput(DataInput in) throws IOException {
  final int len = in.readVInt();
  if (len != 0) {
    in.skipBytes(len);
  }
}