@Override public IndexInput openInput(String name, IOContext context) throws IOException { ensureOpen(); StoreFileMetaData metaData = filesMetadata.get(name); if (metaData == null) { throw new FileNotFoundException(name); } IndexInput in = metaData.directory().openInput(name, context); boolean success = false; try { // Only for backward comp. since we now use Lucene codec compression if (name.endsWith(".fdt") || name.endsWith(".tvf")) { Compressor compressor = CompressorFactory.compressor(in); if (compressor != null) { in = compressor.indexInput(in); } } success = true; } finally { if (!success) { IOUtils.closeWhileHandlingException(in); } } return in; }
@Override public IndexInput openInput(String name, IOContext context) throws IOException { StoreFileMetaData metaData = filesMetadata.get(name); if (metaData == null) { throw new FileNotFoundException(name); } IndexInput in = metaData.directory().openInput(name, context); // Only for backward comp. since we now use Lucene codec compression if (name.endsWith(".fdt") || name.endsWith(".tvf")) { Compressor compressor = CompressorFactory.compressor(in); if (compressor != null) { in = compressor.indexInput(in); } } return in; }
public static HandlesStreamInput cachedHandlesCompressed(Compressor compressor, StreamInput in) throws IOException { Entry entry = instance(); entry.handles.reset(compressor.streamInput(in)); return entry.handles; }
public static StreamInput compressed(Compressor compressor, StreamInput in) throws IOException { return compressor.streamInput(in); }