### Question:
LittleEndianDataInput implements DataInput { public final void readFully(final byte b[]) throws IOException { readFully(b, 0, b.length); } LittleEndianDataInput(final InputStream in); final int readUnsignedShort(); final long readUnsignedInt(); final boolean readBoolean(); final byte readByte(); final int readUnsignedByte(); final short readShort(); final char readChar(); final int readInt(); final long readLong(); final float readFloat(); final double readDouble(); final void readFully(final byte b[]); final void readFully(final byte b[], final int off, final int len); final int skipBytes(final int n); final String readLine(); final String readUTF(); final void close(); final int available(); public int CHAR_SIZE; }### Answer:
@Test public void testReadFully1() throws Exception { in.addBytesAvailable(11111); littleEndien.readFully(array); }
@Test public void testReadFully2() throws Exception { in.addBytesAvailable(11240); littleEndien.readFully(array, 0, 4); }
@Test public void testReadFully3() throws Exception { array = new byte[30003]; Thread testThread = new Thread(new Runnable() { public void run() { try { littleEndien.readFully(array); } catch (IOException e) { e.printStackTrace(); fail("ioexception"); } } }); testThread.start(); in.addBytesAvailable(10000); assertTrue("still alive", testThread.isAlive()); Thread.sleep(6); in.addBytesAvailable(10001); assertTrue("still alive", testThread.isAlive()); in.addBytesAvailable(10002); testThread.join(); }
@Test (expected = EOFException.class) public void testReadFully4() throws Exception { in.setEof(true); littleEndien.readFully(array); }