Package java.io

Examples of java.io.InputStream.reset()


            assertEquals("Read After Reset [" + i +"]"(position + i), input.read());
        }

        // Reset after read limit passed
        try {
            input.reset();
            fail("Read limit exceeded, expected IOException ");
        } catch (IOException e) {
            assertEquals("Read limit IOException message",
                         "Marked position [" + position
                         + "] is no longer valid - passed the read limit ["
View Full Code Here


        } catch (UnsupportedOperationException e) {
            assertEquals("mark() error message""Mark not supported", e.getMessage());
        }

        try {
            input.reset();
            fail("reset() should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            assertEquals("reset() error message""Mark not supported", e.getMessage());
        }
    }
View Full Code Here

        in.read();
        in.mark(10);

        in.read();
        in.read();
        in.reset();
        assertEquals('B', in.read());
    }

    public void testMarkResetAfterReadWithBOM() throws Exception {
        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
View Full Code Here

        in.read();
        in.mark(10);

        in.read();
        in.read();
        in.reset();
        assertEquals('B', in.read());
    }

    public void testMarkResetBeforeReadWithoutBOM() throws Exception {
        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
View Full Code Here

        in.mark(10);

        in.read();
        in.read();
        in.reset();
        assertEquals('A', in.read());
    }

    public void testMarkResetBeforeReadWithBOM() throws Exception {
        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
View Full Code Here

        in.mark(10);

        in.read();
        in.read();
        in.reset();
        assertEquals('A', in.read());
    }

    public void testAvailableWithoutBOM() throws Exception {
        byte[] data = new byte[] { 'A', 'B', 'C', 'D' };
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) {
                    public Object readUnshared() throws IOException, ClassNotFoundException {
                        return null;
View Full Code Here

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

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

        new ByteArrayInputStream(bytes), 12);
    try {
      in.skip(6);
      in.mark(14);
      in.read(new byte[14], 0, 14);
      in.reset();
      assertTrue("Wrong bytes", in.read() == 6 && in.read() == 7);
    } catch (IOException e) {
      fail("Exception during mark test 2");
    }
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.