Package com.peterhi.obsolete

Examples of com.peterhi.obsolete.Stream


  }
 
  @Test
  public void pReadByte_void() 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], stream.readByte());
      }
     
      assertEquals(1, stream.getData().readable());
    } finally {
    }
  }
View Full Code Here


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

  }
 
  @Test
  public void pReadUnsignedByte_void() 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] & 0xff, stream.readUnsignedByte());
      }
     
      assertEquals(1, stream.getData().readable());
    } finally {
    }
  }
View Full Code Here

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

  }
 
  @Test
  public void pReadShort_void() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
     
      for (short sh : sampleShorts()) {
        stream.writeShort(sh);
      }
     
      stream.writeBit(1);
     
      stream.readBit();
     
      for (int i = 0; i < sampleShorts().length; i++) {
        assertEquals(sampleShorts()[i], stream.readShort());
      }
     
      assertEquals(1, stream.getData().readable());
    } finally {
    }
  }
View Full Code Here

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

  }
 
  @Test
  public void pReadUnsignedShort_void() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
     
      for (short sh : sampleShorts()) {
        stream.writeShort(sh);
      }
     
      stream.writeBit(1);
     
      stream.readBit();
     
      for (int i = 0; i < sampleShorts().length; i++) {
        assertEquals(sampleShorts()[i] & 0xffff, stream.readUnsignedShort());
      }
     
      assertEquals(1, stream.getData().readable());
    } finally {
    }
  }
View Full Code Here

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

  }
 
  @Test
  public void pReadChar_void() throws Exception {
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
     
      for (char ch : sampleChars()) {
        stream.writeChar(ch);
      }
     
      stream.writeBit(1);
     
      stream.readBit();
     
      for (int i = 0; i < sampleChars().length; i++) {
        assertEquals(sampleChars()[i], stream.readChar());
      }
     
      assertEquals(1, stream.getData().readable());
    } finally {
    }
  }
View Full Code Here

  }
 
  @Test
  public void fReadChar_void() throws Exception {
    try {
      Stream stream = new Stream();
      stream.readChar();
      fail();
    } catch (EOFException ex) {
    } finally {
    }
   
    try {
      Stream stream = new Stream();
      stream.writeBit(1);
      stream.readChar();
      fail();
    } catch (InsufficientBufferException ex) {
    } finally {
    }
   
    try {
      Stream stream = new Stream();
      stream.write(1);
      stream.readChar();
      fail();
    } catch (InsufficientBufferException ex) {
    } 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.