Code example for InflaterInputStream

Methods: closeread

        FileOutputStream fos1 = new FileOutputStream(f1);
        DeflaterOutputStream dos1 = new DeflaterOutputStream(fos1);
        dos1.write(byteArray, 2, 3);
        FileInputStream fis = new FileInputStream(f1);
        InflaterInputStream iis = new InflaterInputStream(fis);
        assertEquals("Incorrect Byte Returned.", 4,;
        assertEquals("Incorrect Byte Returned.", 7,;
        assertEquals("Incorrect Byte Returned.", 8,;
        assertEquals("Incorrect Byte Returned (EOF).", -1,;
        assertEquals("Incorrect Byte Returned (EOF).", -1,;
        // Test for trying to write more bytes than available from the array 
        File f2 = new File("writeBII2.tst");
        FileOutputStream fos2 = new FileOutputStream(f2);
        DeflaterOutputStream dos2 = new DeflaterOutputStream(fos2);
        try { 
            dos2.write(byteArray, 2, 10);
Experience pair programming with AI  Get Codota for Java