Package com.peterhi.obsolete

Examples of com.peterhi.obsolete.Stream


  }
 
  @Test
  public void pReadInt_void() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
     
      for (NumWithInfo nwi : genNumWithInfos(Integer.SIZE)) {
        stream.writeInt(nwi.getNumber().intValue());
      }
     
      stream.writeBit(1);
     
      stream.readBit();
     
      for (NumWithInfo nwi : genNumWithInfos(Integer.SIZE)) {
        assertEquals(nwi.getNumber().intValue(), stream.readInt());
      }
     
      assertEquals(1, stream.getData().readable());
    } finally {
    }
  }
View Full Code Here


  }
 
  @Test
  public void fReadInt_void() throws Exception {
    try {
      Stream stream = new Stream();
      stream.readInt();
      fail();
    } catch (EOFException ex) {
    } finally {
    }
   
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.readInt();
      fail();
    } catch (InsufficientBufferException ex) {
    } finally {
    }
   
    try {
      Stream stream = new Stream();
      stream.write(1);
      stream.write(1);
      stream.write(1);
      stream.readInt();
      fail();
    } catch (InsufficientBufferException ex) {
    } finally {
    }
  }
View Full Code Here

  }
 
  @Test
  public void pReadUnsignedInt_void() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
     
      for (NumWithInfo nwi : genNumWithInfos(Integer.SIZE)) {
        stream.writeInt(nwi.getNumber().intValue());
      }
     
      stream.writeBit(1);
     
      stream.readBit();
     
      for (NumWithInfo nwi : genNumWithInfos(Integer.SIZE)) {
        long mask = 0xffffffffL;
        assertEquals(nwi.getNumber().longValue() & mask, stream.readUnsignedInt());
      }
     
      assertEquals(1, stream.getData().readable());
    } finally {
    }
  }
View Full Code Here

  }
 
  @Test
  public void fReadUnsignedInt_void() throws Exception {
    try {
      Stream stream = new Stream();
      stream.readUnsignedInt();
      fail();
    } catch (EOFException ex) {
    } finally {
    }
   
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.readUnsignedInt();
      fail();
    } catch (InsufficientBufferException ex) {
    } finally {
    }
   
    try {
      Stream stream = new Stream();
      stream.write(1);
      stream.write(1);
      stream.write(1);
      stream.readUnsignedInt();
      fail();
    } catch (InsufficientBufferException ex) {
    } finally {
    }
  }
View Full Code Here

 
  @Test
  public void pCtor_Data() throws Exception {
    try {
      Data data = new Data();
      Stream stream = new Stream(data);
      assertEquals(data, stream.getData());
    } finally {
    }
  }
View Full Code Here

  }
 
  @Test
  public void fCtor_Data() throws Exception {
    try {
      Stream stream = new Stream((Data )null);
      fail();
    } catch (NullPointerException ex) {
    } finally {
    }
  }
View Full Code Here

  }
 
  @Test
  public void pCtor_void() throws Exception {
    try {
      Stream stream = new Stream();
    } finally {
    }
  }
View Full Code Here

 
  @Test
  public void pGetData_void() throws Exception {
    try {
      Data data = new Data();
      Stream stream = new Stream(data);
      assertEquals(data, stream.getData());
    } finally {
    }
  }
View Full Code Here

      byte[] buffer = new byte[] {
        Integer.valueOf("01010101", 2).byteValue()
      };
     
      Data data = new Data(buffer);
      Stream stream = new Stream(buffer);
     
      for (int i = 0; i < 9; i++) {
        assertEquals(data.read(), stream.readBit());
      }
    } finally {
    }
  }
View Full Code Here

      byte[] buffer = new byte[] {
        Integer.valueOf("01010101", 2).byteValue()
      };
     
      Data data = new Data(buffer);
      Stream stream = new Stream(buffer);
     
      for (int i = 0; i < 8; i++) {
        assertEquals(data.read2(), stream.readBit2());
      }
    } finally {
    }
  }
View Full Code Here

TOP

Related Classes of com.peterhi.obsolete.Stream

Copyright © 2018 www.massapicom. 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.