Example #1
0
 /// <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;
     }
 }
Example #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;
 }
Example #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;
 }
Example #4
0
 /// <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
     {
         if (Debugging.AssertsEnabled)
         {
             Debugging.Assert(!(directory is CompoundFileDirectory), "compound file inside of compound file: {0}", fileName);
         }
         this.entries = SENTINEL;
         this.IsOpen  = true;
         writer       = new CompoundFileWriter(directory, fileName);
         handle       = null;
     }
 }
 /// <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;
     }
 }
 internal DirectCFSIndexOutput(CompoundFileWriter outerInstance, IndexOutput @delegate, FileEntry entry, bool isSeparate)
     : base()
 {
     this.OuterInstance = outerInstance;
     this.@delegate = @delegate;
     this.Entry = entry;
     entry.Offset = Offset = @delegate.FilePointer;
     this.IsSeparate = isSeparate;
 }