Example #1
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
     {
         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
 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.GetBufferSize(context)));
 }