Package com.peterhi.obsolete

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


  public void pReadFully_byteArray() throws Exception {
    try {
      Stream stream = new Stream(sampleBytes());
      byte[] sample = new byte[0];
     
      stream.readFully(sample);
      assertEquals(sampleBytes().length, stream.available());
     
      sample = new byte[2];
      stream.readFully(sample);
     
View Full Code Here


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

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

        assertEquals(sampleBytes()[i + 2], sample[i]);
      }
     
      assertEquals(0, stream.available());
      sample = new byte[0];
      stream.readFully(sample);
      assertEquals(0, stream.available());
    } finally {
    }
  }
 
View Full Code Here

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

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

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

 
  @Test
  public void fReadFully_byteArray_int_int() throws Exception {
    try {
      Stream stream = new Stream();
      stream.readFully(null, 0, 0);
      fail();
    } catch (NullPointerException ex) {
    } finally {
    }
   
View Full Code Here

    } finally {
    }
   
    try {
      Stream stream = new Stream();
      stream.readFully(new byte[0], -1, 0);
      fail();
    } catch (IllegalArgumentException ex) {
    } finally {
    }
   
View Full Code Here

    } finally {
    }
   
    try {
      Stream stream = new Stream();
      stream.readFully(new byte[0], 0, -1);
      fail();
    } catch (IllegalArgumentException 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.