List of usage examples for org.apache.lucene.store BufferedIndexInput BufferedIndexInput
BufferedIndexInput
From source file:com.nearinfinity.mele.store.hdfs.HdfsDirectory.java
License:Apache License
@Override public IndexInput openInput(final String name) throws IOException { final FSDataInputStream inputStream = fileSystem.open(new Path(hdfsDirPath, name)); return new BufferedIndexInput() { private long length = fileLength(name); @Override//from w w w. jav a 2 s . c o m public long length() { return length; } @Override public void close() throws IOException { inputStream.close(); } @Override protected void seekInternal(long pos) throws IOException { } @Override protected void readInternal(byte[] b, int offset, int length) throws IOException { synchronized (inputStream) { long position = getFilePointer(); inputStream.seek(position); inputStream.read(b, offset, length); } } }; }