List of usage examples for org.apache.lucene.store DataInput readInt
public int readInt() throws IOException
From source file:com.browseengine.bobo.geosearch.merge.impl.BufferedGeoMerger.java
License:Apache License
/** * /*from w w w.j a v a 2 s . c o m*/ * @param directory * @param geoFileName * @param fieldNameFilterConverter * @return true iff successful * @throws IOException */ protected boolean loadFieldNameFilterConverter(Directory directory, String geoFileName, IFieldNameFilterConverter fieldNameFilterConverter) throws IOException { try { DataInput input = directory.openInput(geoFileName); input.readVInt(); //read version input.readInt(); //throw out tree position input.readVInt(); //throw out tree size input.readVInt(); //throw out record length fieldNameFilterConverter.loadFromInput(input); return true; } catch (FileNotFoundException e) { LOGGER.warn("suppressing missing geo file pair, treating as no field names: " + e); return false; } }
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);/* w ww .j a v a 2 s .c om*/ 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 w ww .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();/*from ww w. j a va2 s .c om*/ } 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(); }