/// <summary>
 /// Create a new <see cref="CompoundFileDirectory"/>.
 /// </summary>
 public CompoundFileDirectory(Directory directory, string fileName, IOContext context, bool openForWrite)
 {
     this.directory      = directory;
     this.fileName       = fileName;
     this.readBufferSize = BufferedIndexInput.GetBufferSize(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.DisposeWhileHandlingException(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;
     }
 }
示例#2
0
 internal DirectCFSIndexOutput(CompoundFileWriter outerInstance, IndexOutput @delegate, FileEntry entry, bool isSeparate)
     : base()
 {
     this.outerInstance = outerInstance;
     this.@delegate     = @delegate;
     this.entry         = entry;
     entry.Offset       = offset = @delegate.GetFilePointer();
     this.isSeparate    = isSeparate;
 }
示例#3
0
 internal DirectCFSIndexOutput(CompoundFileWriter outerInstance, IndexOutput @delegate, FileEntry entry, bool isSeparate)
     : base()
 {
     this.outerInstance = outerInstance;
     this.@delegate     = @delegate;
     this.entry         = entry;
     entry.Offset       = offset = @delegate.Position; // LUCENENET specific: Renamed from getFilePointer() to match FileStream
     this.isSeparate    = isSeparate;
 }