Package com.peterhi.obsolete

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


     
      stream.readBit();

      for (NumWithInfo nwi : genNumWithInfos(Integer.SIZE)) {
        if (nwi.isNormal()) {
          assertEquals(nwi.getNumber().intValue(), stream.readInt(nwi.getBits()));
        } else {
          BigInteger flow = BigInteger.valueOf(2).pow(nwi.getBits());
          BigInteger left = nwi.getNumber();
          BigInteger right = BigInteger.valueOf(stream.readInt(nwi.getBits()));
         
View Full Code Here


        if (nwi.isNormal()) {
          assertEquals(nwi.getNumber().intValue(), stream.readInt(nwi.getBits()));
        } else {
          BigInteger flow = BigInteger.valueOf(2).pow(nwi.getBits());
          BigInteger left = nwi.getNumber();
          BigInteger right = BigInteger.valueOf(stream.readInt(nwi.getBits()));
         
          if (nwi.isOverflow()) {
            left = left.subtract(flow);
          } else {
            left = left.add(flow);
View Full Code Here

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

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

    try {
      Stream stream = new Stream();
      stream.write(1);
      stream.write(1);
      stream.write(1);
      stream.readInt(32);
      fail();
    } catch (InsufficientBufferException ex) {
    } finally {
    }
  }
View Full Code Here

      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 {
    }
   
View Full Code Here

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

    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

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.