Examples of POIFSReader


Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

        poiFs.writeFilesystem(out);
        out.close();

        /* Read the POIFS: */
        final PropertySet[] psa = new PropertySet[1];
        final POIFSReader r = new POIFSReader();
        r.registerListener(new POIFSReaderListener()
            {
                public void processPOIFSReaderEvent
                    (final POIFSReaderEvent event)
                {
                    try
                    {
                        psa[0] = PropertySetFactory.create(event.getStream());
                    }
                    catch (Exception ex)
                    {
                        ex.printStackTrace();
                        throw new RuntimeException(ex.toString());
                        /* FIXME (2): Replace the previous line by the following
                         * one once we no longer need JDK 1.3 compatibility. */
                        // throw new RuntimeException(ex);
                    }
                }
            },
            STREAM_NAME);
        r.read(new FileInputStream(filename));
        Assert.assertNotNull(psa[0]);
        Section s = (Section) (psa[0].getSections().get(0));
        assertEquals(s.getFormatID(), formatID);
        Object p = s.getProperty(2);
        Assert.assertEquals(SECTION1, p);
View Full Code Here

Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

                             SummaryInformation.DEFAULT_STREAM_NAME);
        poiFs.writeFilesystem(out);
        out.close();

        /* Read the POIFS: */
        final POIFSReader r = new POIFSReader();
        r.registerListener(new MyPOIFSReaderListener(),
                           SummaryInformation.DEFAULT_STREAM_NAME);
        r.read(new FileInputStream(filename));
    }
View Full Code Here

Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

        poiFs.writeFilesystem(out);
        out.close();
   
        /* Read the POIFS: */
        final PropertySet[] psa = new PropertySet[1];
        final POIFSReader r = new POIFSReader();
        r.registerListener(new POIFSReaderListener()
            {
                public void processPOIFSReaderEvent
                    (final POIFSReaderEvent event)
                {
                    try
                    {
                        psa[0] = PropertySetFactory.create(event.getStream());
                    }
                    catch (Exception ex)
                    {
                        fail(org.apache.poi.hpsf.Util.toString(ex));
                    }
                }
   
            },
            SummaryInformation.DEFAULT_STREAM_NAME);
        r.read(new FileInputStream(filename));
        Assert.assertNotNull(psa[0]);
        Assert.assertTrue(psa[0].isSummaryInformation());

        final Section s = (Section) (psa[0].getSections().get(0));
        Object p1 = s.getProperty(PropertyIDMap.PID_AUTHOR);
View Full Code Here

Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

        poiFs.writeFilesystem(out);
        out.close();

        /* Read the POIFS: */
        final PropertySet[] psa = new PropertySet[1];
        final POIFSReader r = new POIFSReader();
        r.registerListener(new POIFSReaderListener()
            {
                public void processPOIFSReaderEvent
                    (final POIFSReaderEvent event)
                {
                    try
                    {
                        psa[0] = PropertySetFactory.create(event.getStream());
                    }
                    catch (Exception ex)
                    {
                        ex.printStackTrace();
                        throw new RuntimeException(ex.toString());
                        /* FIXME (2): Replace the previous line by the following
                         * one once we no longer need JDK 1.3 compatibility. */
                        // throw new RuntimeException(ex);
                    }
                }
            },
            STREAM_NAME);
        r.read(new FileInputStream(filename));
        Assert.assertNotNull(psa[0]);
        Section s = (Section) (psa[0].getSections().get(0));
        assertEquals(s.getFormatID(), formatID);
        Object p = s.getProperty(2);
        Assert.assertEquals(SECTION1, p);
View Full Code Here

Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

                             SummaryInformation.DEFAULT_STREAM_NAME);
        poiFs.writeFilesystem(out);
        out.close();

        /* Read the POIFS: */
        final POIFSReader r = new POIFSReader();
        r.registerListener(new MyPOIFSReaderListener(),
                           SummaryInformation.DEFAULT_STREAM_NAME);
        FileInputStream stream = new FileInputStream(filename);
        try {
            r.read(stream);
        } finally {
            stream.close();
        }
    }
View Full Code Here

Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

        poiFs.writeFilesystem(out);
        out.close();

        /* Read the POIFS: */
        final PropertySet[] psa = new PropertySet[1];
        final POIFSReader r = new POIFSReader();
        r.registerListener(new POIFSReaderListener()
            {
                public void processPOIFSReaderEvent
                    (final POIFSReaderEvent event)
                {
                    try
                    {
                        psa[0] = PropertySetFactory.create(event.getStream());
                    }
                    catch (Exception ex)
                    {
                        fail(org.apache.poi.hpsf.Util.toString(ex));
                    }
                }

            },
            SummaryInformation.DEFAULT_STREAM_NAME);
       
        InputStream stream = new FileInputStream(filename);
        try {
            r.read(stream);
        } finally {
            stream.close();
        }
        assertNotNull(psa[0]);
        assertTrue(psa[0].isSummaryInformation());
View Full Code Here

Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

        poiFs.writeFilesystem(out);
        out.close();

        /* Read the POIFS: */
        final PropertySet[] psa = new PropertySet[1];
        final POIFSReader r = new POIFSReader();
        r.registerListener(new POIFSReaderListener()
            {
                public void processPOIFSReaderEvent
                    (final POIFSReaderEvent event)
                {
                    try
                    {
                        psa[0] = PropertySetFactory.create(event.getStream());
                    }
                    catch (Exception ex)
                    {
                        ex.printStackTrace();
                        throw new RuntimeException(ex.toString());
                        /* FIXME (2): Replace the previous line by the following
                         * one once we no longer need JDK 1.3 compatibility. */
                        // throw new RuntimeException(ex);
                    }
                }
            },
            STREAM_NAME);
        FileInputStream stream = new FileInputStream(filename);
        try {
            r.read(stream);
        } finally {
            stream.close();
        }
        assertNotNull(psa[0]);
        Section s = (psa[0].getSections().get(0));
View Full Code Here

Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

      BLOBFileValue blob = (BLOBFileValue) values[0].internalValue();

      try {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        MsPowerPointListener listener = new MsPowerPointListener(baos);
        POIFSReader reader = new POIFSReader();
        reader.registerListener(listener);
        reader.read(blob.getStream());
        Map result = new HashMap();
        result.put(FieldNames.FULLTEXT, new InputStreamReader(
            new ByteArrayInputStream(baos.toByteArray())));
       
        return result;
View Full Code Here

Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

  /**
   * Extracts properties and text from an MS Document input stream
   */
  protected void extract(InputStream input) throws Exception {
    // First, extract properties
    this.reader = new POIFSReader();
    this.properties = new PropertiesBroker();
    this.reader.registerListener(
            new PropertiesReaderListener(this.properties),
            SummaryInformation.DEFAULT_STREAM_NAME);
    input.reset();
View Full Code Here

Examples of org.apache.poi.poifs.eventfilesystem.POIFSReader

  private StringBuffer text = null;
  private POIFSReader reader = null;
 
 
  protected String extractText(InputStream input) throws Exception {
    this.reader = new POIFSReader();
    this.text = new StringBuffer();
    reader.registerListener(
            new ContentReaderListener(this.text),
            PPTConstants.POWERPOINT_DOCUMENT);
    input.reset();
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.