Package java.io

Examples of java.io.Reader.markSupported()


  @Test
  public void testMarkSupported() throws IOException
  {
    Reader data = new StringReader(DATA);
    Reader reader = new LimitReader(data, 10);
    assertEquals(data.markSupported(), reader.markSupported());
  }

  @Test
  public void testMarkAndReset() throws IOException
  {
View Full Code Here


  @Test
  public void testMarkSupported() throws IOException
  {
    Reader reader = new ConcatReader(mock(Reader.class));
    assertFalse(reader.markSupported());
  }

  @Test(expected = IOException.class)
  public void testMark() throws IOException
  {
View Full Code Here

        assertEquals(-1, reader.read());
        assertEquals(false, reader.ready());
        assertEquals(0, reader.skip(2));
        assertEquals(0, reader.skip(-1));
       
        assertEquals(true, reader.markSupported());
        reader = sb.asReader();
        assertEquals('s', reader.read());
        reader.mark(-1);
        char[] array = new char[3];
        assertEquals(3, reader.read(array, 0, 3));
View Full Code Here

    public void testMarkAndReset() throws Exception {
        int position = 0;
        int readlimit = 10;
        Reader reader = new TestNullReader(100, true, false);
       
        assertTrue("Mark Should be Supported", reader.markSupported());

        // No Mark
        try {
            reader.reset();
            fail("Read limit exceeded, expected IOException ");
View Full Code Here

    /**
     * Test <code>mark()</code> not supported.
     */
    public void testMarkNotSupported() throws Exception {
        Reader reader = new TestNullReader(100, false, true);
        assertFalse("Mark Should NOT be Supported", reader.markSupported());

        try {
            reader.mark(5);
            fail("mark() should throw UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
View Full Code Here

    }

    /** Test {@link Reader#markSupported()}. */
    public void testMarkSupported() {
        Reader reader = new CharSequenceReader("FooBar");
        assertTrue(reader.markSupported());
    }

    /** Test {@link Reader#mark(int)}. */
    public void testMark() throws IOException {
        Reader reader = new CharSequenceReader("FooBar");
View Full Code Here

  @Test
  public void testMarkSupported() throws IOException
  {
    Reader data = new StringReader(DATA);
    CountingReader reader = new CountingReader(data);
    assertEquals(data.markSupported(), reader.markSupported());
  }

  @Test
  public void testMarkAndReset() throws IOException
  {
View Full Code Here

        assertEquals(-1, reader.read());
        assertEquals(false, reader.ready());
        assertEquals(0, reader.skip(2));
        assertEquals(0, reader.skip(-1));
       
        assertEquals(true, reader.markSupported());
        reader = sb.asReader();
        assertEquals('s', reader.read());
        reader.mark(-1);
        char[] array = new char[3];
        assertEquals(3, reader.read(array, 0, 3));
View Full Code Here

    }

    @Override
    public boolean markSupported() {
      Reader rdr = getReader();
      return rdr != null && rdr.markSupported();
    }

    @Override
    public void mark(int readAheadLimit) throws IOException {
      Reader rdr = getReader();
View Full Code Here

        assertEquals(-1, reader.read());
        assertEquals(false, reader.ready());
        assertEquals(0, reader.skip(2));
        assertEquals(0, reader.skip(-1));
       
        assertEquals(true, reader.markSupported());
        reader = sb.asReader();
        assertEquals('s', reader.read());
        reader.mark(-1);
        char[] array = new char[3];
        assertEquals(3, reader.read(array, 0, 3));
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.