Esempio n. 1
0
        /**
         * remove an entry
         *
         * @param entry to be Removed
         */

        public void Remove(EntryNode entry)
        {
            // If it's a document, free the blocks
            if (entry is DocumentEntry)
            {
                NPOIFSDocument doc = new NPOIFSDocument((DocumentProperty)entry.Property, this);
                doc.Free();
            }
            _property_table.RemoveProperty(entry.Property);
        }
Esempio n. 2
0
 /**
  * Create an InputStream from the specified Document
  *
  * @param document the Document to be read
  */
 public NDocumentInputStream(NPOIFSDocument document)
 {
     _current_offset      = 0;
     _current_block_count = 0;
     _marked_offset       = 0;
     _marked_offset_count = 0;
     _document_size       = document.Size;
     _closed   = false;
     _document = document;
     _data     = _document.GetBlockIterator();
 }
        /**
         * Create an OutputStream from the specified DocumentEntry.
         * The specified entry will be emptied.
         * 
         * @param document the DocumentEntry to be written
         */
        public NDocumentOutputStream(DocumentEntry document)
        {
            if (!(document is DocumentNode))
            {
                throw new IOException("Cannot open internal document storage, " + document + " not a Document Node");
            }
            _document_size = 0;
            _closed = false;

            _property = (DocumentProperty)((DocumentNode)document).Property;

            _document = new NPOIFSDocument((DocumentNode)document);
            _document.Free();
        }
Esempio n. 4
0
        /**
         * Create an OutputStream from the specified DocumentEntry.
         * The specified entry will be emptied.
         *
         * @param document the DocumentEntry to be written
         */
        public NDocumentOutputStream(DocumentEntry document)
        {
            if (!(document is DocumentNode))
            {
                throw new IOException("Cannot open internal document storage, " + document + " not a Document Node");
            }
            _document_size = 0;
            _closed        = false;

            _property = (DocumentProperty)((DocumentNode)document).Property;

            _document = new NPOIFSDocument((DocumentNode)document);
            _document.Free();
        }
Esempio n. 5
0
        /**
         * Create an OutputStream to create the specified new Entry
         *
         * @param parent Where to create the Entry
         * @param name Name of the new entry
         */
        public NDocumentOutputStream(DirectoryEntry parent, String name)
        {
            if (!(parent is DirectoryNode))
            {
                throw new IOException("Cannot open internal directory storage, " + parent + " not a Directory Node");
            }
            _document_size = 0;
            _closed        = false;

            // Have an empty one Created for now
            DocumentEntry doc = parent.CreateDocument(name, new MemoryStream(new byte[0]));

            _property = (DocumentProperty)((DocumentNode)doc).Property;
            _document = new NPOIFSDocument((DocumentNode)doc);
        }
Esempio n. 6
0
        public DocumentEntry CreateDocument(NPOIFSDocument document)
        {
            try
            {
                DocumentProperty property = document.DocumentProperty;
                DocumentNode     rval     = new DocumentNode(property, this);

                ((DirectoryProperty)Property).AddChild(property);

                _nFilesSystem.AddDocument(document);

                _entries.Add(rval);
                _byname[property.Name] = rval;

                return(rval);
            }
            catch (IOException ex)
            {
                throw ex;
            }
        }
Esempio n. 7
0
        /**
         * Create an InputStream from the specified DocumentEntry
         *
         * @param document the DocumentEntry to be read
         *
         * @exception IOException if the DocumentEntry cannot be opened (like, maybe it has
         *                been deleted?)
         */
        public NDocumentInputStream(DocumentEntry document)
        {
            if (!(document is DocumentNode))
            {
                throw new IOException("Cannot open internal document storage, " + document + " not a Document Node");
            }
            _current_offset      = 0;
            _current_block_count = 0;
            _marked_offset       = 0;
            _marked_offset_count = 0;
            _document_size       = document.Size;
            _closed = false;

            DocumentNode     doc      = (DocumentNode)document;
            DocumentProperty property = (DocumentProperty)doc.Property;

            _document = new NPOIFSDocument(
                property,
                ((DirectoryNode)doc.Parent).NFileSystem
                );
            _data = _document.GetBlockIterator();
        }
        /**
         * Create an OutputStream to create the specified new Entry
         * 
         * @param parent Where to create the Entry
         * @param name Name of the new entry
         */
        public NDocumentOutputStream(DirectoryEntry parent, String name)
        {
            if (!(parent is DirectoryNode))
            {
                throw new IOException("Cannot open internal directory storage, " + parent + " not a Directory Node");
            }
            _document_size = 0;
            _closed = false;

            // Have an empty one Created for now
            DocumentEntry doc = parent.CreateDocument(name, new MemoryStream(new byte[0]));
            _property = (DocumentProperty)((DocumentNode)doc).Property;
            _document = new NPOIFSDocument((DocumentNode)doc);
        }
Esempio n. 9
0
 /**
  * Create an InputStream from the specified Document
  * 
  * @param document the Document to be read
  */
 public DocumentInputStream(NPOIFSDocument document)
 {
     delegate1 = new NDocumentInputStream(document);
 }
Esempio n. 10
0
 /**
  * add a new POIFSDocument to the FileSytem
  *
  * @param document the POIFSDocument being Added
  */
 public void AddDocument(NPOIFSDocument document)
 {
     _property_table.AddProperty(document.DocumentProperty);
 }
Esempio n. 11
0
 /**
  * Create an InputStream from the specified Document
  * 
  * @param document the Document to be read
  */
 public NDocumentInputStream(NPOIFSDocument document)
 {
     _current_offset = 0;
     _current_block_count = 0;
     _marked_offset = 0;
     _marked_offset_count = 0;
     _document_size = document.Size;
     _closed = false;
     _document = document;
     _data = _document.GetBlockIterator();
 }
Esempio n. 12
0
        /**
         * Create an InputStream from the specified DocumentEntry
         * 
         * @param document the DocumentEntry to be read
         * 
         * @exception IOException if the DocumentEntry cannot be opened (like, maybe it has
         *                been deleted?)
         */
        public NDocumentInputStream(DocumentEntry document)
        {
            if (!(document is DocumentNode))
            {
                throw new IOException("Cannot open internal document storage, " + document + " not a Document Node");
            }
            _current_offset = 0;
            _current_block_count = 0;
            _marked_offset = 0;
            _marked_offset_count = 0;
            _document_size = document.Size;
            _closed = false;

            DocumentNode doc = (DocumentNode)document;
            DocumentProperty property = (DocumentProperty)doc.Property;
            _document = new NPOIFSDocument(
                  property,
                      ((DirectoryNode)doc.Parent).NFileSystem
            );
            _data = _document.GetBlockIterator();
        }
Esempio n. 13
0
 /**
  * Create an InputStream from the specified Document
  *
  * @param document the Document to be read
  */
 public DocumentInputStream(NPOIFSDocument document)
 {
     delegate1 = new NDocumentInputStream(document);
 }
Esempio n. 14
0
        /**
         * remove an entry
         *
         * @param entry to be Removed
         */

        public void Remove(EntryNode entry)
        {
            // If it's a document, free the blocks
            if (entry is DocumentEntry) {
                NPOIFSDocument doc = new NPOIFSDocument((DocumentProperty)entry.Property, this);
                doc.Free();
            }
            _property_table.RemoveProperty(entry.Property);
        }
Esempio n. 15
0
 /**
  * add a new POIFSDocument to the FileSytem 
  *
  * @param document the POIFSDocument being Added
  */
 public void AddDocument(NPOIFSDocument document)
 {
     _property_table.AddProperty(document.DocumentProperty);
 }