Package java.io

Examples of java.io.Reader.skip()


    }

    @Override
    public long skip(long n) throws IOException {
      Reader rdr = getReader();
      return rdr != null ? rdr.skip(n) : 0;
    }

    @Override
    public boolean ready() throws IOException {
      Reader rdr = getReader();
View Full Code Here


        Reader reader = new UTF8Reader(
                csd, this.conChild, this.synchronizationObject);
        long leftToSkip = pos -1;
        long skipped;
        while (leftToSkip > 0) {
            skipped = reader.skip(leftToSkip);
            // Since Reader.skip block until some characters are available,
            // a return value of 0 must mean EOF.
            if (skipped <= 0) {
                throw new EOFException("Reached end-of-stream prematurely");
            }
View Full Code Here

                conChild.getConnectionSynchronization());

        long leftToSkip = pos -1;
        long skipped;
        while (leftToSkip > 0) {
            skipped = isr.skip(leftToSkip);
            // Since Reader.skip block until some characters are available,
            // a return value of 0 must mean EOF.
            if (skipped <= 0) {
                throw new EOFException("Reached end-of-stream prematurely");
            }
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

    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

    for (int i = 0; i < 256; i++)
      chars[i] = (char) i;
    Reader in = new BufferedReader(new Support_StringReader(new String(
        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);
View Full Code Here

    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);
    in.mark(8);
    in.skip(7);
    in.reset();
    assertTrue("Wrong chars 2", in.read() == (char) 6
        && in.read() == (char) 7);
View Full Code Here

        && in.read() == (char) 7);

    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);
View Full Code Here

  public void testSkipZero() throws Exception {
    CharSource source = newCharSource("a");
    Iterable<CharSource> list = ImmutableList.of(source, source);
    Reader joinedReader = CharSource.concat(list).openStream();

    assertEquals(0, joinedReader.skip(0));
    assertEquals('a', joinedReader.read());
  }

}
View Full Code Here

    private static void checkInternalStream(long pos, StoreStreamClob clob)
            throws IOException, SQLException {
        Reader canonStream = new LoopingAlphabetReader(pos + 100);
        long toSkip = pos -1; // Convert to 0-based index.
        while (toSkip > 0) {
            long skipped = canonStream.skip(toSkip);
            if (skipped > 0) {
                toSkip -= skipped;
            }
        }
        Reader clobStream = clob.getInternalReader(pos);
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.