Package java.util.zip

Examples of java.util.zip.DeflaterInputStream


    /**
     * @tests DeflaterInputStream#DeflaterInputStream(InputStream,Deflater)
     */
    public void testDeflaterInputStreamInputStreamDeflater() {
        // ok
        new DeflaterInputStream(is, new Deflater());
        // fail
        try {
            new DeflaterInputStream(is, null);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }
        try {
            new DeflaterInputStream(null, new Deflater());
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }
    }
View Full Code Here


    /**
     * @tests DeflaterInputStream#DeflaterInputStream(InputStream,Deflater,int)
     */
    public void testDeflaterInputStreamInputStreamDeflaterInt() {
        // ok
        new DeflaterInputStream(is, new Deflater(), 1024);
        // fail
        try {
            new DeflaterInputStream(is, null, 1024);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }
        try {
            new DeflaterInputStream(null, new Deflater(), 1024);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }
        try {
            new DeflaterInputStream(is, new Deflater(), -1);
            fail("should throw IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            // expected
        }
        try {
            new DeflaterInputStream(null, new Deflater(), -1);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }
        try {
            new DeflaterInputStream(is, null, -1);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected
        }
    }
View Full Code Here

              }
              else if (contentEnc.equalsIgnoreCase("deflate"))
              {
                if (!(in instanceof DeflaterInputStream))
                {
                  in = new DeflaterInputStream(in);
                }
              }
            }
           
            if ( false )
View Full Code Here

              }
              else if (contentEnc.equalsIgnoreCase("deflate"))
              {
                if (!(in instanceof DeflaterInputStream))
                {
                  in = new DeflaterInputStream(in);
                }
              }
            }
           
            if ( false )
View Full Code Here

              }
              else if (contentEnc.equalsIgnoreCase("deflate"))
              {
                if (!(in instanceof DeflaterInputStream))
                {
                  in = new DeflaterInputStream(in);
                }
              }
            }
           
            if ( false )
View Full Code Here

        return new Deflater(_deflateCompressionLevel, _deflateNoWrap);
    }

    private ServletRequest wrapDeflatedRequest(HttpServletRequest request) throws IOException {
        final Deflater deflater = buildDeflater();
        final DeflaterInputStream input = new DeflaterInputStream(request.getInputStream(), deflater, _bufferSize) {
            @Override
            public void close() throws IOException {
                deflater.reset();
                localDeflater.set(deflater);
                super.close();
View Full Code Here

              }
              else if (contentEnc.equalsIgnoreCase("deflate"))
              {
                if (!(in instanceof DeflaterInputStream))
                {
                  in = new DeflaterInputStream(in);
                }
              }
            }
           
            if ( false )
View Full Code Here

    /**
     * @tests DeflaterInputStream#available()
     */
    public void testAvailable() throws IOException {
        byte[] buf = new byte[1024];
        DeflaterInputStream dis = new DeflaterInputStream(is);
        assertEquals(1, dis.available());
        assertEquals(120, dis.read());
        assertEquals(1, dis.available());
        assertEquals(22, dis.read(buf, 0, 1024));
        assertEquals(1, dis.available());
        assertEquals(-1, dis.read());
        assertEquals(0, dis.available());
        dis.close();
        try {
            dis.available();
            fail("should throw IOException");
        } catch (IOException e) {
            // expected
        }
    }
View Full Code Here

    /**
     * @tests DeflaterInputStream#close()
     */
    public void testClose() throws IOException {
        byte[] buf = new byte[1024];
        DeflaterInputStream dis = new DeflaterInputStream(is);
        assertEquals(1, dis.available());
        dis.close();
        try {
            dis.available();
            fail("should throw IOException");
        } catch (IOException e) {
            // expected
        }
        try {
            dis.read(buf, 0, 1024);
            fail("should throw IOException");
        } catch (IOException e) {
            // expected
        }
        // can close after close
        dis.close();
    }
View Full Code Here

    /**
     * @tests DeflaterInputStream#mark()
     */
    public void testMark() throws IOException {
        // mark do nothing
        DeflaterInputStream dis = new DeflaterInputStream(is);
        dis.mark(-1);
        dis.mark(0);
        dis.mark(1);
        dis.close();
        dis.mark(1);
    }
View Full Code Here

TOP

Related Classes of java.util.zip.DeflaterInputStream

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.