Package org.auraframework.util

Examples of org.auraframework.util.Utf8InputStreamReader.ready()


        final String testChars = "abc123_+/`";
        baos.write(testChars.getBytes(Charsets.UTF_8));
        final Reader reader = new Utf8InputStreamReader(new ByteArrayInputStream(baos.toByteArray()));
        final char[] actual = new char[10];
        try {
            assertTrue(reader.ready());
            assertEquals(8, reader.read(actual, 0, 8));
            assertFalse(reader.ready());
            assertEquals(2, reader.read(actual, 8, 8));
            assertEquals(-1, reader.read(actual, 10, 8));
            assertEquals(-1, reader.read());
View Full Code Here


        final Reader reader = new Utf8InputStreamReader(new ByteArrayInputStream(baos.toByteArray()));
        final char[] actual = new char[10];
        try {
            assertTrue(reader.ready());
            assertEquals(8, reader.read(actual, 0, 8));
            assertFalse(reader.ready());
            assertEquals(2, reader.read(actual, 8, 8));
            assertEquals(-1, reader.read(actual, 10, 8));
            assertEquals(-1, reader.read());
            assertEquals(-1, reader.read(actual));
            assertFalse(reader.ready());
View Full Code Here

            assertFalse(reader.ready());
            assertEquals(2, reader.read(actual, 8, 8));
            assertEquals(-1, reader.read(actual, 10, 8));
            assertEquals(-1, reader.read());
            assertEquals(-1, reader.read(actual));
            assertFalse(reader.ready());

            // Ensure that we match
            assertTrue(Arrays.equals(testChars.toCharArray(), actual));
        } finally {
            reader.close();
View Full Code Here

        }
        final Reader reader = new Utf8InputStreamReader(in);
        final char[] actual = new char[testChars.length()];
        try {
            if (!oneByteAtATime) {
                assertTrue(reader.ready());
            }
            assertEquals(testChars.length(), reader.read(actual));
            assertEquals(-1, reader.read());
            assertEquals(-1, reader.read(actual, 10, 8));
            assertEquals(-1, reader.read(actual));
View Full Code Here

            }
            assertEquals(testChars.length(), reader.read(actual));
            assertEquals(-1, reader.read());
            assertEquals(-1, reader.read(actual, 10, 8));
            assertEquals(-1, reader.read(actual));
            assertFalse(reader.ready());

            // Ensure that we match
            assertTrue(Arrays.equals(testChars.toCharArray(), actual));
        } finally {
            reader.close();
View Full Code Here

        baos.write(0xfe); // not valid UTF-8
        baos.write(0xff); // not valid UTF-8
        baos.write('i');
        final Reader reader = new Utf8InputStreamReader(new ByteArrayInputStream(baos.toByteArray()));
        try {
            assertTrue(reader.ready());
            assertEquals('h', reader.read());
            assertFalse(reader.ready());
            assertEquals('i', reader.read());
            assertEquals(-1, reader.read());
            assertFalse(reader.ready());
View Full Code Here

        baos.write('i');
        final Reader reader = new Utf8InputStreamReader(new ByteArrayInputStream(baos.toByteArray()));
        try {
            assertTrue(reader.ready());
            assertEquals('h', reader.read());
            assertFalse(reader.ready());
            assertEquals('i', reader.read());
            assertEquals(-1, reader.read());
            assertFalse(reader.ready());
        } finally {
            reader.close();
View Full Code Here

            assertTrue(reader.ready());
            assertEquals('h', reader.read());
            assertFalse(reader.ready());
            assertEquals('i', reader.read());
            assertEquals(-1, reader.read());
            assertFalse(reader.ready());
        } finally {
            reader.close();
        }
    }
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.