@Override public IndexInput openInput(String name, IOContext context) throws IOException { ensureOpen(); ensureCanRead(name); Path path = getDirectory().resolve(name); FileChannel fc = FileChannel.open(path, StandardOpenOption.READ); return new NIOFSIndexInput("NIOFSIndexInput(path=\"" + path + "\")", fc, context); }
/** Creates an IndexInput for the file with the given name. */ @Override public IndexInput openInput(String name, IOContext context) throws IOException { ensureOpen(); Path path = getDirectory().resolve(name); FileChannel fc = FileChannel.open(path, StandardOpenOption.READ); return new NIOFSIndexInput("NIOFSIndexInput(path=\"" + path + "\")", fc, context); }
public IndexInput openInput(String name, int bufferSize) throws IOException { ensureOpen(); return new NIOFSIndexInput(new File(getFile(), name), bufferSize); }
/** Creates an IndexInput for the file with the given name. */ @Override public IndexInput openInput(String name, IOContext context) throws IOException { ensureOpen(); Path path = getDirectory().resolve(name); FileChannel fc = FileChannel.open(path, StandardOpenOption.READ); return new NIOFSIndexInput("NIOFSIndexInput(path=\"" + path + "\")", fc, context); }
public IndexInput openInput(String name, int bufferSize) throws IOException { ensureOpen(); return new NIOFSIndexInput(new File(getFile(), name), bufferSize); }
@Override public IndexInput openInput(String name, IOContext context) throws IOException { ensureOpen(); ensureCanRead(name); Path path = getDirectory().resolve(name); FileChannel fc = FileChannel.open(path, StandardOpenOption.READ); return new NIOFSIndexInput("NIOFSIndexInput(path=\"" + path + "\")", fc, context); }
/** Creates an IndexInput for the file with the given name. */ @Override public IndexInput openInput(String name, IOContext context) throws IOException { ensureOpen(); return new NIOFSIndexInput(new File(getDirectory(), name), context, getReadChunkSize()); }
@Override public IndexInputSlicer createSlicer(final String name, final IOContext context) throws IOException { ensureOpen(); final File path = new File(getDirectory(), name); final RandomAccessFile descriptor = new RandomAccessFile(path, "r"); return new Directory.IndexInputSlicer() { @Override public void close() throws IOException { descriptor.close(); } @Override public IndexInput openSlice(String sliceDescription, long offset, long length) { return new NIOFSIndexInput(sliceDescription, path, descriptor, descriptor.getChannel(), offset, length, BufferedIndexInput.bufferSize(context), getReadChunkSize()); } @Override public IndexInput openFullSlice() { try { return openSlice("full-slice", 0, descriptor.length()); } catch (IOException ex) { throw new RuntimeException(ex); } } }; }