List of usage examples for org.apache.lucene.store IndexInput readLong
public long readLong() throws IOException
From source file:com.bah.lucene.blockcache_v2.CacheDirectoryTest.java
License:Apache License
@Test public void test1() throws IOException { IndexOutput output = _cacheDirectory.createOutput("test.file", IOContext.DEFAULT); output.writeLong(0);//w w w . j a va 2 s . c o m output.writeLong(1); output.writeLong(2); output.close(); IndexInput input = _cacheDirectory.openInput("test.file", IOContext.DEFAULT); assertEquals(0, input.readLong()); assertEquals(1, input.readLong()); assertEquals(2, input.readLong()); input.close(); }
From source file:com.bah.lucene.blockcache_v2.CacheIndexInputTest.java
License:Apache License
public static void readRandomDataLong(IndexInput baseInput, IndexInput testInput, Random random, int sampleSize) throws IOException { assertEquals(baseInput.length(), testInput.length()); int fileLength = (int) baseInput.length(); for (int i = 0; i < sampleSize; i++) { int position = random.nextInt(fileLength - 8); baseInput.seek(position);// ww w. jav a 2s .c o m long i1 = baseInput.readLong(); testInput.seek(position); long i2 = testInput.readLong(); assertEquals("Read [" + i + "] The position is [" + position + "]", i1, i2); } }
From source file:com.browseengine.bobo.geosearch.solo.impl.IDGeoRecordSerializer.java
License:Apache License
@Override public IDGeoRecord readGeoRecord(IndexInput input, int recordByteCount) throws IOException { long highOrder = input.readLong(); int lowOrder = input.readInt(); int countIdBytes = recordByteCount - INTERLACE_BYTES; byte[] id = new byte[countIdBytes]; input.readBytes(id, 0, countIdBytes, false); return new IDGeoRecord(highOrder, lowOrder, id); }
From source file:com.github.lucene.store.jdbc.index.AbstractIndexInputOutputITest.java
License:Apache License
private void verifyData() throws IOException { final byte[] test = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }; Assert.assertTrue(jdbcDirectory.fileExists("value1")); Assert.assertEquals(36, jdbcDirectory.fileLength("value1")); final IndexInput indexInput = jdbcDirectory.openInput("value1", new IOContext()); Assert.assertEquals(-1, indexInput.readInt()); Assert.assertEquals(10, indexInput.readLong()); Assert.assertEquals(0, indexInput.readInt()); Assert.assertEquals(0, indexInput.readInt()); indexInput.readBytes(test, 0, 8);/* w ww. ja v a 2 s . c om*/ Assert.assertEquals((byte) 1, test[0]); Assert.assertEquals((byte) 8, test[7]); indexInput.readBytes(test, 0, 5); Assert.assertEquals((byte) 1, test[0]); Assert.assertEquals((byte) 5, test[4]); indexInput.seek(28); Assert.assertEquals((byte) 1, indexInput.readByte()); indexInput.seek(30); Assert.assertEquals((byte) 3, indexInput.readByte()); indexInput.close(); }
From source file:com.nearinfinity.bloomfilter.bitset.ThreadSafeBitSet.java
License:Apache License
@Override public void read(IndexInput input) throws IOException { int length = input.readInt(); bits = new AtomicLongArray(length); for (int i = 0; i < length; i++) { bits.set(i, input.readLong()); }/*from w w w . j a v a 2 s. c o m*/ }
From source file:com.nearinfinity.bloomfilter.BloomFilter.java
License:Apache License
public void read(IndexInput input) throws IOException { numberOfBitsDivBy2 = input.readLong(); elementSize = input.readLong();/*from www .j av a 2s . c o m*/ probabilityOfFalsePositives = Double.longBitsToDouble(input.readLong()); hashes = input.readInt(); numberOfBits = input.readInt(); bitSet = new ThreadSafeBitSet(); bitSet.read(input); }
From source file:com.nearinfinity.blur.store.compressed.CompressedFieldDataDirectory.java
License:Apache License
private int getVersion(IndexInput indexInput) throws IOException { long length = indexInput.length(); indexInput.seek(length - 8);// ww w .j a v a 2s. c o m long l = indexInput.readLong(); if (l < 0) { return (int) Math.abs(l); } else { return 0; } }
From source file:com.nearinfinity.blur.store.compressed.CompressedFieldDataDirectory.java
License:Apache License
public long fileLength(String name) throws IOException { if (compressedFileExists(name)) { IndexInput input = _directory.openInput(getCompressedName(name)); try {/*from w w w .ja v a 2 s. c om*/ long length = input.length(); input.seek(length - 8); long fileLength = input.readLong(); if (fileLength < 0) { input.seek(length - 16); return input.readLong(); } else { return fileLength; } } finally { input.close(); } } return _directory.fileLength(name); }
From source file:com.rocana.lucene.codec.v1.RocanaBlockTreeTermsReader.java
License:Apache License
/** Seek {@code input} to the directory offset. */ private void seekDir(IndexInput input, long dirOffset) throws IOException { input.seek(input.length() - CodecUtil.footerLength() - 8); dirOffset = input.readLong(); input.seek(dirOffset);//from w w w . jav a 2 s .com }
From source file:org.apache.blur.lucene.codec.DiskDocValuesProducer.java
License:Apache License
static NumericEntry readNumericEntry(IndexInput meta) throws IOException { NumericEntry entry = new NumericEntry(); entry.packedIntsVersion = meta.readVInt(); entry.offset = meta.readLong(); entry.count = meta.readVLong();//from w w w. j a va 2 s .c o m entry.blockSize = meta.readVInt(); return entry; }