public void ProcessPOIFSWriterEvent(POIFSWriterEvent ev)
 {
     try
     {
         ;
     }
     catch (IOException exception)
     {
         throw new Exception("Exception on write: " + exception.Message);
     }
 }
 public void ProcessPOIFSWriterEvent(POIFSWriterEvent ev)
 {
     try
     {
         ev.Stream.Write(0);
         Console.WriteLine("Send an event");
     }
     catch (IOException exception)
     {
         throw new Exception("Exception on write: " + exception.Message);
     }
 }
示例#3
0
        /* **********  END  implementation of POIFSReaderListener ********** */
        /* ********** START implementation of POIFSWriterListener ********** */

        /**
         * Process a POIFSWriterEvent that this listener had registered
         * for
         *
         * @param evt the POIFSWriterEvent
         */

        public void ProcessPOIFSWriterEvent(POIFSWriterEvent evt)
        {
            try
            {
                DocumentDescriptor descriptor =
                    new DocumentDescriptor(evt.Path, evt.Name);

                Console.WriteLine("looking up document: " + descriptor + " ("
                                   + evt.Limit + " bytes)");
                evt.Stream.Write((byte[])dataMap[descriptor]);
            }
            catch (IOException)
            {
                Console.WriteLine("Unable to Write document");
                //e.printStackTrace();
                //System.exit(1);
                throw;
            }
        }
 public void ProcessPOIFSWriterEvent(POIFSWriterEvent ev)
 {
     TestEmptyDocument._logger.Log(POILogger.WARN, "Written");
     Console.WriteLine("Written");
 }
示例#5
0
        public NPOIFSDocument(String name, int size, NPOIFSFileSystem filesystem, POIFSWriterListener Writer)
        {
            this._filesystem = filesystem;

            if (size < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE)
            {
                _stream = new NPOIFSStream(filesystem.GetMiniStore());
                _block_size = _filesystem.GetMiniStore().GetBlockStoreBlockSize();
            }
            else
            {
                _stream = new NPOIFSStream(filesystem);
                _block_size = _filesystem.GetBlockStoreBlockSize();
            }

            Stream innerOs = _stream.GetOutputStream();
            DocumentOutputStream os = new DocumentOutputStream(innerOs, size);
            POIFSDocumentPath path = new POIFSDocumentPath(name.Split(new string[] { "\\\\" }, StringSplitOptions.RemoveEmptyEntries));
            String docName = path.GetComponent(path.Length - 1);
            POIFSWriterEvent event1 = new POIFSWriterEvent(os, path, docName, size);
            Writer.ProcessPOIFSWriterEvent(event1);
            innerOs.Close();

            // And build the property for it
            this._property = new DocumentProperty(name, size);
            _property.StartBlock = (/*setter*/_stream.GetStartBlock());
        }