Package com.peterhi.obsolete

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


    }
   
    try {
      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());
View Full Code Here


    } catch (NullPointerException ex) {
    }
   
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      byte[] sample = new byte[1];
      stream.read(sample);
      fail();
    } catch (InsufficientBufferException ex) {
    }
View Full Code Here

 
  @Test
  public void pRead_byteArray_int_int() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.write(sampleBytes());
      stream.writeBit(1);
      stream.write(sampleBytes());
     
      byte[] sample = new byte[sampleBytes().length];
View Full Code Here

  public void pRead_byteArray_int_int() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.write(sampleBytes());
      stream.writeBit(1);
      stream.write(sampleBytes());
     
      byte[] sample = new byte[sampleBytes().length];
      stream.readBit();
      assertEquals(sampleBytes().length, stream.read(sample));
View Full Code Here

    }
   
    try {
      Stream stream = new Stream();
      stream.write(1);
      stream.writeBit(1);
      byte[] sample = new byte[5];
      assertEquals(1, stream.read(sample, 2, 3));
      assertEquals(1, stream.getData().readable());
    } finally {
    }
View Full Code Here

    }
   
    try {
      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());
View Full Code Here

    } catch (IndexOutOfBoundsException ex) {
    }
   
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.read(new byte[1], 0, 1);
      fail();
    } catch (InsufficientBufferException ex) {
    }
  }
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));
View Full Code Here

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

  @Test
  public void pAvailable_void() throws Exception {
    try {
      Stream stream = new Stream();
      assertEquals(0, stream.available());
      stream.writeBit(1);
      assertEquals(0, stream.available());
      stream.write(8);
      assertEquals(1, stream.available());
      stream.writeInt(0, 7);
      assertEquals(2, stream.available());
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.