/// <summary> /// Create a new CompoundFileDirectory. /// </summary> public CompoundFileDirectory(Directory directory, string fileName, IOContext context, bool openForWrite) { this.Directory_Renamed = directory; this.FileName = fileName; this.ReadBufferSize = BufferedIndexInput.BufferSize(context); this.isOpen = false; this.OpenForWrite = openForWrite; if (!openForWrite) { bool success = false; Handle = directory.CreateSlicer(fileName, context); try { this.Entries = ReadEntries(Handle, directory, fileName); success = true; } finally { if (!success) { IOUtils.CloseWhileHandlingException(Handle); } } this.isOpen = true; Writer = null; } else { Debug.Assert(!(directory is CompoundFileDirectory), "compound file inside of compound file: " + fileName); this.Entries = SENTINEL; this.isOpen = true; Writer = new CompoundFileWriter(directory, fileName); Handle = null; } }
public override IndexInput OpenSlice(string sliceDescription, long offset, long length) { return(new SimpleFSIndexInput("SimpleFSIndexInput(" + sliceDescription + " in path=\"" + File.FullName + "\" slice=" + offset + ":" + (offset + length) + ")", Descriptor, offset, length, BufferedIndexInput.BufferSize(Context))); }