List of usage examples for org.apache.lucene.store RAMInputStream RAMInputStream
public RAMInputStream(String name, RAMFile f) throws IOException
From source file:com.foundationdb.lucene.FDBDirectory.java
License:Open Source License
@Override public IndexInput openInput(String name, IOContext context) throws IOException { long dataID = getDataID(name); if (dataID == -1) { throw new FileNotFoundException(name); }//from www . j a va2 s. c om InputFile file = new InputFile(); int totalLen = 0; for (KeyValue kv : txn.getRange(dataSubspace.add(dataID).range())) { byte[] value = kv.getValue(); byte[] ramValue = file.addBufferInternal(value.length); totalLen += value.length; System.arraycopy(value, 0, ramValue, 0, value.length); } file.setLengthInternal(totalLen); return new RAMInputStream(name, file); }