Package com.peterhi.obsolete

Examples of com.peterhi.obsolete.Stream.skip()


      Stream stream = new Stream();
      stream.write(1);
      stream.writeBit(1);
      byte[] sample = new byte[0];
      assertEquals(0, stream.read(sample));
      stream.skip(1);
      assertEquals(0, stream.read(sample));
      assertEquals(1, stream.readBit());
      assertEquals(-1, stream.read(sample));
      assertEquals(0, stream.getData().readable());
    } finally {
View Full Code Here


      Stream stream = new Stream();
      stream.write(1);
      stream.writeBit(1);
      byte[] sample = new byte[50];
      assertEquals(0, stream.read(sample, 10, 0));
      stream.skip(1);
      assertEquals(0, stream.read(sample, 20, 0));
      assertEquals(1, stream.readBit());
      assertEquals(-1, stream.read(sample, 10, 0));
      assertEquals(0, stream.getData().readable());
    } finally {
View Full Code Here

  @Test
  public void pSkip_long() throws Exception {
    try {
      Stream stream = new Stream(sampleBytes());
      stream.writeBit(1);
      assertEquals(0, stream.skip(0));
      assertEquals(1, stream.skip(1));
      assertEquals(sampleBytes()[1], (byte )stream.read());
      assertEquals(7, stream.skip(10));
      assertEquals(0, stream.skip(0));
      assertEquals(1, stream.getData().readable());
View Full Code Here

  public void pSkip_long() throws Exception {
    try {
      Stream stream = new Stream(sampleBytes());
      stream.writeBit(1);
      assertEquals(0, stream.skip(0));
      assertEquals(1, stream.skip(1));
      assertEquals(sampleBytes()[1], (byte )stream.read());
      assertEquals(7, stream.skip(10));
      assertEquals(0, stream.skip(0));
      assertEquals(1, stream.getData().readable());
      stream.readBit();
View Full Code Here

      Stream stream = new Stream(sampleBytes());
      stream.writeBit(1);
      assertEquals(0, stream.skip(0));
      assertEquals(1, stream.skip(1));
      assertEquals(sampleBytes()[1], (byte )stream.read());
      assertEquals(7, stream.skip(10));
      assertEquals(0, stream.skip(0));
      assertEquals(1, stream.getData().readable());
      stream.readBit();
      assertEquals(-1, stream.skip(5));
    } finally {
View Full Code Here

      stream.writeBit(1);
      assertEquals(0, stream.skip(0));
      assertEquals(1, stream.skip(1));
      assertEquals(sampleBytes()[1], (byte )stream.read());
      assertEquals(7, stream.skip(10));
      assertEquals(0, stream.skip(0));
      assertEquals(1, stream.getData().readable());
      stream.readBit();
      assertEquals(-1, stream.skip(5));
    } finally {
    }
View Full Code Here

      assertEquals(sampleBytes()[1], (byte )stream.read());
      assertEquals(7, stream.skip(10));
      assertEquals(0, stream.skip(0));
      assertEquals(1, stream.getData().readable());
      stream.readBit();
      assertEquals(-1, stream.skip(5));
    } finally {
    }
  }
 
  @Test
View Full Code Here

 
  @Test
  public void fSkip_long() throws Exception {
    try {
      Stream stream = new Stream(sampleBytes());
      stream.skip(-1);
      fail();
    } catch (IllegalArgumentException ex) {
    } finally {
    }
   
View Full Code Here

    }
   
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.skip(1);
    } catch (InsufficientBufferException ex) {
    } finally {
    }
  }
 
View Full Code Here

 
  @Test
  public void fSkipBytes_int() throws Exception {
    try {
      Stream stream = new Stream(sampleBytes());
      stream.skip(-1);
      fail();
    } catch (IllegalArgumentException ex) {
    } finally {
    }
  }
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.