Examples of skip()


Examples of org.apache.activemq.store.kahadb.disk.util.DataByteArrayOutputStream.skip()

                ByteSequence sequence = buff.toByteSequence();
               
                // Now we can fill in the batch control record properly.
                buff.reset();
                buff.skip(5+Journal.BATCH_CONTROL_RECORD_MAGIC.length);
                buff.writeInt(sequence.getLength()-Journal.BATCH_CONTROL_RECORD_SIZE);
                if( journal.isChecksum() ) {
                  Checksum checksum = new Adler32();
                  checksum.update(sequence.getData(), sequence.getOffset()+Journal.BATCH_CONTROL_RECORD_SIZE, sequence.getLength()-Journal.BATCH_CONTROL_RECORD_SIZE);
                  buff.writeLong(checksum.getValue());
View Full Code Here

Examples of org.apache.commons.compress.compressors.pack200.Pack200CompressorInputStream.skip()

            byte[] rest = new byte[3];
            assertEquals(3, is.read(rest));
            assertEquals(0x4b, rest[0]);
            assertEquals(3, rest[1]);
            assertEquals(4, rest[2]);
            assertEquals(1, is.skip(1));
            is.reset();
            assertEquals(0x50, is.read());
            assertTrue(is.available() > 0);
        } finally {
            is.close();
View Full Code Here

Examples of org.apache.derby.iapi.services.io.ArrayInputStream.skip()

     * Test that we don't get an overflow when the argument to skip() is
     * Long.MAX_VALUE (DERBY-3739).
     */
    public void testSkipLongMaxValue() throws IOException {
        ArrayInputStream ais = new ArrayInputStream(new byte[1000]);
        assertEquals(1000, ais.skip(Long.MAX_VALUE));
        assertEquals(1000, ais.getPosition());
        ais.setPosition(1);
        assertEquals(999, ais.skip(Long.MAX_VALUE));
        assertEquals(1000, ais.getPosition());
    }
View Full Code Here

Examples of org.apache.derby.iapi.types.ReaderToUTF8Stream.skip()

        InputStream ascii = new LoopingAlphabetStream(length);
        InputStream modUTF8 = new ReaderToUTF8Stream(
                                    new LoopingAlphabetReader(length),
                                    length, 0, TYPENAME,
                                    new CharStreamHeaderGenerator());
        modUTF8.skip(HEADER_LENGTH); // Skip encoded length added by ReaderToUTF8Stream.
        assertEquals(ascii, modUTF8);
    }

    public void testSkipUntilEOFOnZeroLengthStream()
            throws IOException {
View Full Code Here

Examples of org.apache.derby.impl.jdbc.PositionedStoreStream.skip()

        }
        assertEquals(10, pss.getPosition());
        assertEquals(-1, pss.read());
        assertEquals(10, pss.getPosition());
        assertEquals(-1, pss.read());
        assertEquals(0, pss.skip(199));
        assertEquals(10, pss.getPosition());
        pss.resetStream();
        assertEquals(0, pss.getPosition());
    }
View Full Code Here

Examples of org.apache.derby.impl.jdbc.UTF8Reader.skip()

    UTF8Reader clobReader = new UTF8Reader(myStream, 0, this, synchronization);

    // skip to the correct position (pos is one based)
    long remainToSkip = position - 1;
    while (remainToSkip > 0) {
      long skipBy = clobReader.skip(remainToSkip);
      if (skipBy == -1)
        return null;

      remainToSkip -= skipBy;
    }
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetReader.skip()

            }
            long pos = 1;
            while (remaining > 0) {
                String str = clob.getSubString(
                        pos, Math.min(MAX_BSIZE, remaining));
                myReader.skip(Math.min(MAX_BSIZE, remaining) -1);
                pos += str.length();
                remaining -= str.length();
                // Avoid failure on the last char when Clob is modified.
                if (!modifyClob || remaining != 0) {
                    assertEquals(myReader.read(), str.charAt(str.length() -1));
View Full Code Here

Examples of org.apache.derbyTesting.functionTests.util.streams.LoopingAlphabetStream.skip()

        ps.execute();
        ps.close();

        // Get last byte from the source stream.
        InputStream cmpIs = new LoopingAlphabetStream(length);
        cmpIs.skip(length -1);
        int srcLastByte = cmpIs.read();
        assertTrue(cmpIs.read() == -1);

        // Read everything first.
        int bytesToRead = 5000;
View Full Code Here

Examples of org.apache.hadoop.fs.FSDataInputStream.skip()

    checkData(actual, readOffset, expected, "Read 2");
    stm.close();
    // Now read using a different API.
    actual = new byte[expected.length-readOffset];
    stm = fs.open(name);
    long skipped = stm.skip(readOffset);
    Assert.assertEquals(skipped, readOffset);
    //Read a small number of bytes first.
    int nread = stm.read(actual, 0, 3);
    nread += stm.read(actual, nread, 2);
    //Read across chunk boundary
View Full Code Here

Examples of org.apache.hadoop.hdfs.util.ExactSizeInputStream.skip()

  @Test
  public void testBasicsSkip() throws IOException {
    ExactSizeInputStream s = new ExactSizeInputStream(byteStream("hello"), 3);
    assertEquals(3, s.available());
   
    assertEquals(2, s.skip(2));
    assertEquals(1, s.skip(2));
    assertEquals(0, s.skip(2));
  }
 
  @Test
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.