Package org.apache.poi.util

Examples of org.apache.poi.util.DummyPOILogger


     *  as people seem to have "valid" truncated files
     */
    public void testShortConstructor() throws Exception
    {
        // Get the logger to be used
        DummyPOILogger logger = (DummyPOILogger)POILogFactory.getLogger(
            RawDataBlock.class
        );
        assertEquals(0, logger.logged.size());
       
        // Test for various data sizes
        for (int k = 1; k <= 512; k++)
        {
            byte[] data = new byte[ k ];

            for (int j = 0; j < k; j++)
            {
                data[ j ] = ( byte ) j;
            }
            RawDataBlock block = null;
           
            logger.reset();
            assertEquals(0, logger.logged.size());
           
            // Have it created
            block = new RawDataBlock(new ByteArrayInputStream(data));
            assertNotNull(block);
View Full Code Here


     *  won't return a full block at a time, we don't
     *  incorrectly think that there's not enough data
     */
    public void testSlowInputStream() throws Exception {
        // Get the logger to be used
        DummyPOILogger logger = (DummyPOILogger)POILogFactory.getLogger(
            RawDataBlock.class
        );
        assertEquals(0, logger.logged.size());
       
        // Test for various ok data sizes
        for (int k = 1; k < 512; k++) {
            byte[] data = new byte[ 512 ];
            for (int j = 0; j < data.length; j++) {
                data[j] = (byte) j;
            }
           
            // Shouldn't complain, as there is enough data,
            //  even if it dribbles through
            RawDataBlock block =
              new RawDataBlock(new SlowInputStream(data, k));
            assertFalse(block.eof());
        }
       
        // But if there wasn't enough data available, will
        //  complain
        for (int k = 1; k < 512; k++) {
            byte[] data = new byte[ 511 ];
            for (int j = 0; j < data.length; j++) {
                data[j] = (byte) j;
            }
           
            logger.reset();
            assertEquals(0, logger.logged.size());
           
            // Should complain, as there isn't enough data
            RawDataBlock block =
              new RawDataBlock(new SlowInputStream(data, k));
View Full Code Here

TOP

Related Classes of org.apache.poi.util.DummyPOILogger

Copyright © 2018 www.massapicom. 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.