Package java.io

Examples of java.io.Reader.reset()


                        caw.append((char)c);
                    }
                } catch (IOException ignored) {
                }
                caw.close();
                try{ rdr.reset();} catch(IOException ignored) {}
                ret = new StreamSource(new CharArrayReader(caw.toCharArray()));
            } else {
                ret = new StreamSource();
            }
        }
View Full Code Here


        chars)), 12);

    in.skip(6);
    in.mark(14);
    in.read(new char[14], 0, 14);
    in.reset();
    assertTrue("Wrong chars", in.read() == (char) 6
        && in.read() == (char) 7);

    in = new BufferedReader(new Support_StringReader(new String(chars)), 12);
    in.skip(6);
View Full Code Here

    in = new BufferedReader(new Support_StringReader(new String(chars)), 12);
    in.skip(6);
    in.mark(8);
    in.skip(7);
    in.reset();
    assertTrue("Wrong chars 2", in.read() == (char) 6
        && in.read() == (char) 7);
   
        BufferedReader br = new BufferedReader(new StringReader("01234"), 2);
        br.mark(3);
View Full Code Here

            Reader mr = reader.markSupported() ? reader : new BufferedReader(reader);
            mr.mark(1);
            if (mr.read() == -1) {
                throw new XMLStreamException("JSON expression can not be empty!");
            }
            mr.reset();
            return mr;
        } catch (IOException ex) {
            throw new XMLStreamException(ex);
        }
    }
View Full Code Here

        char[] array = new char[3];
        assertEquals(3, reader.read(array, 0, 3));
        assertEquals('o', array[0]);
        assertEquals('m', array[1]);
        assertEquals('e', array[2]);
        reader.reset();
        assertEquals(1, reader.read(array, 1, 1));
        assertEquals('o', array[0]);
        assertEquals('o', array[1]);
        assertEquals('e', array[2]);
        assertEquals(2, reader.skip(2));
View Full Code Here

        assertEquals(0, array[2]);
       
        reader.skip(9);
        assertEquals(-1, reader.read(array, 0, 1));
       
        reader.reset();
        array = new char[30];
        assertEquals(9, reader.read(array, 0, 30));
    }

    //-----------------------------------------------------------------------
View Full Code Here

        char[] array = new char[3];
        assertEquals(3, reader.read(array, 0, 3));
        assertEquals('o', array[0]);
        assertEquals('m', array[1]);
        assertEquals('e', array[2]);
        reader.reset();
        assertEquals(1, reader.read(array, 1, 1));
        assertEquals('o', array[0]);
        assertEquals('o', array[1]);
        assertEquals('e', array[2]);
        assertEquals(2, reader.skip(2));
View Full Code Here

        assertEquals(0, array[2]);
       
        reader.skip(9);
        assertEquals(-1, reader.read(array, 0, 1));
       
        reader.reset();
        array = new char[30];
        assertEquals(9, reader.read(array, 0, 30));
    }

    //-----------------------------------------------------------------------
View Full Code Here

        chars)), 12);
    try {
      in.skip(6);
      in.mark(14);
      in.read(new char[14], 0, 14);
      in.reset();
      assertTrue("Wrong chars", in.read() == (char) 6
          && in.read() == (char) 7);
    } catch (IOException e) {
      fail("Exception during mark test 2:" + e);
    }
View Full Code Here

    in = new BufferedReader(new Support_StringReader(new String(chars)), 12);
    try {
      in.skip(6);
      in.mark(8);
      in.skip(7);
      in.reset();
      assertTrue("Wrong chars 2", in.read() == (char) 6
          && in.read() == (char) 7);
    } catch (IOException e) {
      fail("Exception during mark test 3:" + e);
    }
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.