Code example for DeflaterOutputStream

Methods: writefinishwrite

        // Need test to see if method finish() actually finishes 
        // Only testing possible errors, not if it actually works 
        File f1 = new File("finish.tst");
        FileOutputStream fos1 = new FileOutputStream(f1);
        DeflaterOutputStream dos = new DeflaterOutputStream(fos1);
        byte byteArray[] = { 1, 3, 4, 6 };
        // Test to see if the same FileOutputStream can be used with the 
        // DeflaterOutputStream after finish is called. 
        try { 
            fail("IOException not thrown");
        } catch (IOException e) {
        // Test for writing with a new FileOutputStream using the same 
        // DeflaterOutputStream. 
Connect your IDE to all the code out there  Get Codota for Java