Package com.peterhi.obsolete

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


  public void pWriteBit_int() throws Exception {
    try {
      Stream stream = new Stream();
     
      for (int i = 0; i < 9; i++) {
        stream.writeBit(i % 2);
      }
     
      stream.writeBit(43553455);
     
      for (int i = 0; i < 9; i++) {
View Full Code Here


     
      for (int i = 0; i < 9; i++) {
        stream.writeBit(i % 2);
      }
     
      stream.writeBit(43553455);
     
      for (int i = 0; i < 9; i++) {
        assertEquals(i % 2, stream.readBit());
      }
     
View Full Code Here

 
  @Test
  public void pWrite_byteArray() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.write(sampleBytes());
      stream.writeBit(1);
      stream.readBit();

      for (int i = 0; i < sampleBytes().length; i++) {
View Full Code Here

  public void pWrite_byteArray() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.write(sampleBytes());
      stream.writeBit(1);
      stream.readBit();

      for (int i = 0; i < sampleBytes().length; i++) {
        assertEquals(sampleBytes()[i], (byte )stream.read());
      }
View Full Code Here

 
  @Test
  public void pWrite_byteArray_int_int() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.write(sampleBytes(), 0, 1);
      stream.writeBit(1);
      stream.write(sampleBytes(), 1, 0);
      stream.write(sampleBytes(), 1, sampleBytes().length - 1);
      stream.writeBit(1);
View Full Code Here

  public void pWrite_byteArray_int_int() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.write(sampleBytes(), 0, 1);
      stream.writeBit(1);
      stream.write(sampleBytes(), 1, 0);
      stream.write(sampleBytes(), 1, sampleBytes().length - 1);
      stream.writeBit(1);
      stream.readBit();
     
View Full Code Here

      stream.writeBit(1);
      stream.write(sampleBytes(), 0, 1);
      stream.writeBit(1);
      stream.write(sampleBytes(), 1, 0);
      stream.write(sampleBytes(), 1, sampleBytes().length - 1);
      stream.writeBit(1);
      stream.readBit();
     
      assertEquals(sampleBytes()[0], (byte )stream.read());
      stream.readBit();
     
View Full Code Here

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

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

 
  @Test
  public void pReadBoolean_void() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.write(1);
      stream.write(0);
      stream.writeBit(1);

      stream.readBit();
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.