Examples of DocumentInputStream


Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

                 * the POI filesystem, else create a new one.
                 */
                DocumentSummaryInformation dsi;
                if (dsiEntry != null)
                {
                    final DocumentInputStream dis = new DocumentInputStream(dsiEntry);
                    final PropertySet ps = new PropertySet(dis);
                    dsi = new DocumentSummaryInformation(ps);
                }
                else
                    dsi = PropertySetFactory.newDocumentSummaryInformation();
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

     dsi=null;
     try
     {
         DocumentEntry dsiEntry = (DocumentEntry)
             dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
         DocumentInputStream dis = new DocumentInputStream(dsiEntry);
         PropertySet ps = new PropertySet(dis);
         dis.close();
         dsi = new DocumentSummaryInformation(ps);
      
        
     }
     catch (FileNotFoundException ex)
     {
         /* There is no document summary information yet. We have to create a
          * new one. */
         dsi = PropertySetFactory.newDocumentSummaryInformation();
         assertNotNull(dsi);
     } catch (IOException e) {
    e.printStackTrace();
    fail();
  } catch (NoPropertySetStreamException e) {
    e.printStackTrace();
    fail();
  } catch (MarkUnsupportedException e) {
    e.printStackTrace();
    fail();
  } catch (UnexpectedPropertySetTypeException e) {
    e.printStackTrace();
    fail();
  }
    assertNotNull(dsi);
    try
    {
        DocumentEntry dsiEntry = (DocumentEntry)
            dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
        DocumentInputStream dis = new DocumentInputStream(dsiEntry);
        PropertySet ps = new PropertySet(dis);
        dis.close();
        si = new SummaryInformation(ps);
     
       
    }
    catch (FileNotFoundException ex)
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

      
       try
       {
           DocumentEntry dsiEntry = (DocumentEntry)
               dir.getEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME);
           DocumentInputStream dis = new DocumentInputStream(dsiEntry);
           PropertySet ps = new PropertySet(dis);
           dis.close();
           dsi = new DocumentSummaryInformation(ps);
       }
       catch (FileNotFoundException ex)
       {
           fail();
       } catch (IOException e) {
      e.printStackTrace();
      fail();
    } catch (NoPropertySetStreamException e) {
      e.printStackTrace();
      fail();
    } catch (MarkUnsupportedException e) {
      e.printStackTrace();
      fail();
    } catch (UnexpectedPropertySetTypeException e) {
      e.printStackTrace();
      fail();
    }
      try
        {
            DocumentEntry dsiEntry = (DocumentEntry)
                dir.getEntry(SummaryInformation.DEFAULT_STREAM_NAME);
            DocumentInputStream dis = new DocumentInputStream(dsiEntry);
            PropertySet ps = new PropertySet(dis);
            dis.close();
            si = new SummaryInformation(ps);
         
           
        }
        catch (FileNotFoundException ex)
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

            throws IOException, TikaException {
        try {
            DocumentEntry entry =
                (DocumentEntry) filesystem.getRoot().getEntry(entryName);
            PropertySet properties =
                new PropertySet(new DocumentInputStream(entry));
            if (properties.isSummaryInformation()) {
                parse(new SummaryInformation(properties), metadata);
            }
            if (properties.isDocumentSummaryInformation()) {
                parse(new DocumentSummaryInformation(properties), metadata);
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

                hssfRequest.addListener(formatListener, FormatRecord.sid);
                hssfRequest.addListener(formatListener, ExtendedFormatRecord.sid);
            }

            // Create event factory and process Workbook (fire events)
            DocumentInputStream documentInputStream = filesystem.createDocumentInputStream("Workbook");
            HSSFEventFactory eventFactory = new HSSFEventFactory();
            eventFactory.processEvents(hssfRequest, documentInputStream);
      }
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

     * adds them to a tree model.</p>
     */
    public void processPOIFSReaderEvent(final POIFSReaderEvent event)
    {
        DocumentDescriptor d;
        final DocumentInputStream is = event.getStream();
        if (!is.markSupported())
            throw new UnsupportedOperationException(is.getClass().getName() +
                " does not support mark().");

        /* Try do handle this document as a property set. We receive
         * an exception if is no property set and handle it as a
         * document of some other format. We are not concerned about
         * that document's details. */
        try
        {
            d = new PropertySetDescriptor(event.getName(), event.getPath(),
                                          is, nrOfBytes);
        }
        catch (HPSFException ex)
        {
            d = new DocumentDescriptor(event.getName(), event.getPath(),
                                       is, nrOfBytes);
        }
        catch (Throwable t)
        {
            System.err.println
                ("Unexpected exception while processing " +
                event.getName() + " in " + event.getPath().toString());
            t.printStackTrace(System.err);
            throw new RuntimeException(t.getMessage());
        }

        is.close();

        final MutableTreeNode parentNode = getNode(d.path, filename, rootNode);
        final MutableTreeNode nameNode = new DefaultMutableTreeNode(d.name);
        parentNode.insert(nameNode, 0);
        final MutableTreeNode dNode = new DefaultMutableTreeNode(d);
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

            hssfRequest.addListener(listener, NumberRecord.sid);
            hssfRequest.addListener(listener, RKRecord.sid);
        }

        // Create event factory and process Workbook (fire events)
        DocumentInputStream documentInputStream = filesystem.createDocumentInputStream("Workbook");
        HSSFEventFactory eventFactory = new HSSFEventFactory();
        eventFactory.processEvents(hssfRequest, documentInputStream);

        if (log.isInfoEnabled()) {
            log.info("Processed " + listener.getRecordCount() + " records");
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

                        POIFSReaderListener listener =
                            ( POIFSReaderListener ) listeners.next();

                        listener.processPOIFSReaderEvent(
                            new POIFSReaderEvent(
                                new DocumentInputStream(document), path,
                                name));
                    }
                }
                else
                {
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

         * @param event
         */

        public void processPOIFSReaderEvent(final POIFSReaderEvent event)
        {
            DocumentInputStream istream = event.getStream();
            POIFSDocumentPath   path    = event.getPath();
            String              name    = event.getName();

            try
            {
                byte[] data = new byte[ istream.available() ];

                istream.read(data);
                int pathLength = path.length();

                for (int k = 0; k < pathLength; k++)
                {
                    System.out.print("/" + path.getComponent(k));
View Full Code Here

Examples of org.apache.poi.poifs.filesystem.DocumentInputStream

           while (entries.hasNext()) {
              copyNodeRecursively((Entry)entries.next(),newTarget);
           }
       } else {
         DocumentEntry dentry = (DocumentEntry)entry;
         DocumentInputStream dstream = new DocumentInputStream(dentry);
         target.createDocument(dentry.getName(),dstream);
         dstream.close();
       }
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.