Package java.io

Examples of java.io.InputStream.reset()


        r1 = is.read(rbuf1);
        assertEquals(rbuf1.length, r1);
        r2 = is.read(rbuf2);
        assertEquals(rbuf2.length, r2);
       
        is.reset();
        r2 = is.read(rbuf2);
        assertEquals(rbuf2.length, r2);
        is.close();

        // read a compressed entry
View Full Code Here


        byte[] rbuf3 = new byte[4185];
        ZipEntry zentry2 = zfile.getEntry("File3.txt");
        is = zfile.getInputStream(zentry2);
        r1 = is.read(rbuf3);
        assertEquals(4183, r1);
        is.reset();
       
        r1 = is.read(rbuf3);
        assertEquals(4183, r1);
        is.close();
View Full Code Here

        is.close();

        is = zfile.getInputStream(zentry2);
        r1 = is.read(rbuf3, 0, 3000);
        assertEquals(3000, r1);
        is.reset();
        r1 = is.read(rbuf3, 0, 3000);
        assertEquals(3000, r1);
        is.close();
    }
   
View Full Code Here

        is.mark(0);
        r = is.read(rbuf1);
        assertEquals(8, r);
        assertEquals(-1, is.read());
       
        is.reset();
        r = is.read(rbuf2);
        assertEquals(8, r);
        assertEquals(-1, is.read());
        is.close();
View Full Code Here

        is.mark(0);
        r = is.read(rbuf3);
        assertEquals(1183, r);
        assertEquals(-1, is.read());
       
        is.reset();
        r = is.read(rbuf3);
        assertEquals(1183, r);
        assertEquals(-1, is.read());
        is.close();
    }
View Full Code Here

            InputStream in = new ByteArrayInputStream(out.toByteArray());

            // should not cause SecurityException
            new ObjectInputStream(in);
            in.reset();

            // should not cause SecurityException
            new ObjectInputStream(in) {};
            in.reset();
View Full Code Here

            new ObjectInputStream(in);
            in.reset();

            // should not cause SecurityException
            new ObjectInputStream(in) {};
            in.reset();

            try {
                new ObjectInputStream(in) {
                    @Override
                    public Object readUnshared() throws IOException, ClassNotFoundException {
View Full Code Here

                fail("should throw SecurityException 1");
            } catch (SecurityException e) {
                // Expected
            }

            in.reset();
            try {
                new ObjectInputStream(in) {
                    @Override
                    public GetField readFields() throws IOException,
                            ClassNotFoundException, NotActiveException {
View Full Code Here

       
        assertTrue("Mark Should be Supported", input.markSupported());

        // No Mark
        try {
            input.reset();
            fail("Read limit exceeded, expected IOException ");
        } catch (IOException e) {
            assertEquals("No Mark IOException message",
                         "No position has been marked",
                         e.getMessage());
View Full Code Here

        for (int i = 0; i < 3; i++) {
            assertEquals("Read After Mark [" + i +"]"(position + i), input.read());
        }

        // Reset
        input.reset();

        // Read From marked position
        for (int i = 0; i < readlimit + 1; i++) {
            assertEquals("Read After Reset [" + i +"]"(position + i), input.read());
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.