Example usage for org.apache.lucene.store DataInput readLong

List of usage examples for org.apache.lucene.store DataInput readLong

Introduction

In this page you can find the example usage for org.apache.lucene.store DataInput readLong.

Prototype

public long readLong() throws IOException 

Source Link

Document

Reads eight bytes and returns a long.

Usage

From source file:com.lucure.core.codec.CompressingStoredFieldsReader.java

License:Apache License

private static void readField(DataInput in, RestrictedStoredFieldVisitor visitor, FieldInfo info, int bits,
        FieldVisibility fieldVisibility) throws IOException {

    switch (bits & TYPE_MASK) {
    case BYTE_ARR:
        int length = in.readVInt();
        byte[] data = new byte[length];
        in.readBytes(data, 0, length);// ww w  .  j a  v  a 2s . c  o m
        visitor.binaryField(info, data, fieldVisibility);
        break;
    case STRING:
        length = in.readVInt();
        data = new byte[length];
        in.readBytes(data, 0, length);
        visitor.stringField(info, new String(data, IOUtils.CHARSET_UTF_8), fieldVisibility);
        break;
    case NUMERIC_INT:
        int intValue = in.readInt();
        visitor.intField(info, intValue, fieldVisibility);
        break;
    case NUMERIC_FLOAT:
        float floatValue = Float.intBitsToFloat(in.readInt());
        visitor.floatField(info, floatValue, fieldVisibility);
        break;
    case NUMERIC_LONG:
        long longValue = in.readLong();
        visitor.longField(info, longValue, fieldVisibility);
        break;
    case NUMERIC_DOUBLE:
        double doubleValue = Double.longBitsToDouble(in.readLong());
        visitor.doubleField(info, doubleValue, fieldVisibility);
        break;
    default:
        throw new AssertionError("Unknown type flag: " + Integer.toHexString(bits));
    }
}

From source file:com.lucure.core.codec.CompressingStoredFieldsReader.java

License:Apache License

private static void skipField(DataInput in, int bits, FieldVisibility cv) throws IOException {
    switch (bits & TYPE_MASK) {
    case BYTE_ARR:
    case STRING://from  ww w . j a  v  a  2 s.c o  m
        final int length = in.readVInt();
        in.skipBytes(length);
        break;
    case NUMERIC_INT:
    case NUMERIC_FLOAT:
        in.readInt();
        break;
    case NUMERIC_LONG:
    case NUMERIC_DOUBLE:
        in.readLong();
        break;
    default:
        throw new AssertionError("Unknown type flag: " + Integer.toHexString(bits));
    }
}

From source file:org.elasticsearch.common.util.BloomFilter.java

License:Apache License

public static BloomFilter deserialize(DataInput in) throws IOException {
    int version = in.readInt(); // we do nothing with this now..., defaults to 0

    int numLongs = in.readInt();
    long[] data = new long[numLongs];
    for (int i = 0; i < numLongs; i++) {
        data[i] = in.readLong();
    }/*  w w  w . j ava  2s  .com*/

    int numberOfHashFunctions = in.readInt();

    int hashType = in.readInt(); // again, nothing to do now...

    return new BloomFilter(new BitArray(data), numberOfHashFunctions);
}

From source file:org.elasticsearch.index.translog.Checkpoint.java

License:Apache License

Checkpoint(DataInput in) throws IOException {
    offset = in.readLong();
    numOps = in.readInt();
    generation = in.readLong();
}