Code example for InputStream

Methods: close, read, reset

0
            is.read(rbuf, 0, r = (int) zentry.getSize());
            assertEquals("getInputStream read incorrect data", "This is text",
                    new String(rbuf, 0, r));
        } catch (java.io.IOException e) {
            fail("IOException during getInputStream");
        } finally { 
            try { 
                is.close();
            } catch (java.io.IOException e) {
                fail("Failed to close input stream");
            } 
        } 
 
        zentry = zfile.getEntry("File2.txt");
        zfile.close();
        try { 
            is = zfile.getInputStream(zentry);
            fail("IllegalStateException expected");
        } catch (IllegalStateException ee) {
            // expected 
        }