Package java.io

Examples of java.io.Reader.skip()


        assertEquals("some text", new String(buf, 0, 9));
       
        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);
View Full Code Here


  public static long getContentLength( ClientResponse response ) {
    // getContentLenght returns -1
      // contentLength = response.getContentLength();
    try {
      Reader reader = response.getReader();
      long actualSkip = reader.skip( Long.MAX_VALUE );
      return actualSkip;   
    } catch ( IOException e ) {
    }
    return -1L;
  }
View Full Code Here

            long left = pos - 1;
            long skipped = 0;
            if (clobLength > 0) {
                println("clobLength: " + clobLength);
                while (left > 0 && skipped >= 0) {
                    skipped = reader.skip(Math.min(1024, left));
                    left -= skipped > 0 ? skipped : 0;
                }
            }
            int numBytes = reader.read(value);
View Full Code Here

        assertEquals(9, reader.read(buf));
        assertEquals("some text", new String(buf, 0, 9));
       
        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());
View Full Code Here

        assertEquals("some text", new String(buf, 0, 9));
       
        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);
View Full Code Here

        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));
        assertEquals(' ', reader.read());
       
        assertEquals(true, reader.ready());
        reader.close();
        assertEquals(true, reader.ready());
View Full Code Here

        assertEquals(0, reader.read(array, 0, 0));
        assertEquals(0, array[0]);
        assertEquals(0, array[1]);
        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

    assertTrue(rs.next());
    c = rs.getClob("DATA");
    Reader in = c.getCharacterStream();
    char[] rspData = new char[data.length()];
    in.skip(offset - 1);
    in.read(rspData);
    in.close();

    assertEquals("Request should be the same as the response", data, new String(rspData));
View Full Code Here

    }

    /** Test {@link Reader#skip(long)}. */
    public void testSkip() throws IOException {
        Reader reader = new CharSequenceReader("FooBar");
        assertEquals(3, reader.skip(3));
        checkRead(reader, "Bar");
        assertEquals(-1, reader.skip(3));
        reader.reset();
        assertEquals(2, reader.skip(2));
        assertEquals(4, reader.skip(10));
View Full Code Here

    /** Test {@link Reader#skip(long)}. */
    public void testSkip() throws IOException {
        Reader reader = new CharSequenceReader("FooBar");
        assertEquals(3, reader.skip(3));
        checkRead(reader, "Bar");
        assertEquals(-1, reader.skip(3));
        reader.reset();
        assertEquals(2, reader.skip(2));
        assertEquals(4, reader.skip(10));
        assertEquals(-1, reader.skip(1));
        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.