JBBPBitInputStream extends FilterInputStream implements JBBPCountableBitStream { public int readUnsignedShort(final JBBPByteOrder byteOrder) throws IOException { final int b0 = this.read(); if (b0 < 0) { throw new EOFException(); } final int b1 = this.read(); if (b1 < 0) { throw new EOFException(); } return byteOrder == JBBPByteOrder.BIG_ENDIAN ? (b0 << 8) | b1 : (b1 << 8) | b0; } JBBPBitInputStream(final InputStream in);  JBBPBitInputStream(final InputStream in, final JBBPBitOrder order); boolean[] readBoolArray(final int items); byte[] readBitsArray(final int items, final JBBPBitNumber bitNumber); byte[] readByteArray(final int items); byte[] readByteArray(final int items, final JBBPByteOrder byteOrder); short[] readShortArray(final int items, final JBBPByteOrder byteOrder); char[] readUShortArray(final int items, final JBBPByteOrder byteOrder); int[] readIntArray(final int items, final JBBPByteOrder byteOrder); float[] readFloatArray(final int items, final JBBPByteOrder byteOrder); long[] readLongArray(final int items, final JBBPByteOrder byteOrder); double[] readDoubleArray(final int items, final JBBPByteOrder byteOrder); int readUnsignedShort(final JBBPByteOrder byteOrder); int readInt(final JBBPByteOrder byteOrder); float readFloat(final JBBPByteOrder byteOrder); long readLong(final JBBPByteOrder byteOrder); double readDouble(final JBBPByteOrder byteOrder); @Override long getCounter(); @Override int getBitBuffer(); @Override int getBufferedBitsNumber(); @Override JBBPBitOrder getBitOrder(); byte readBitField(final JBBPBitNumber numOfBitsToRead); int readBits(final JBBPBitNumber numOfBitsToRead); boolean readBoolean(); int readByte(); @Override synchronized void reset(); @Override synchronized void mark(final int readlimit); void align(final long alignByteNumber); @Override long skip(final long numOfBytes); void alignByte(); boolean hasAvailableData(); @SuppressWarnings("NullableProblems") @Override int read(final byte[] array, final int offset, final int length); @Override void resetCounter(); @SuppressWarnings("NullableProblems") @Override int read(final byte[] array); @Override int read(); String readString(final JBBPByteOrder byteOrder); String[] readStringArray(final int items, final JBBPByteOrder byteOrder);  }
@Test public void testReadUnsignedShort_BigEndian_MSB0() throws Exception { assertEquals(0x482C, asInputStreamMSB0(0x12, 0x34).readUnsignedShort(JBBPByteOrder.BIG_ENDIAN)); }
@Test public void testReadUnsignedShort_LittleEndian() throws Exception { assertEquals(0x3412, asInputStream(0x12, 0x34).readUnsignedShort(JBBPByteOrder.LITTLE_ENDIAN)); }
@Test public void testReadUnsignedShort_LittleEndian_MSB0() throws Exception { assertEquals(0x2C48, asInputStreamMSB0(0x12, 0x34).readUnsignedShort(JBBPByteOrder.LITTLE_ENDIAN)); }
@Test public void testReadUnsignedShort_EOFforEmpty_BigEndian_EOFException() throws Exception { assertThrows(EOFException.class, () -> asInputStream().readUnsignedShort(JBBPByteOrder.BIG_ENDIAN)); }
@Test public void testReadUnsignedShort_EOFforEmpty_LittleEndian_EOFException() throws Exception { assertThrows(EOFException.class, () -> asInputStream().readUnsignedShort(JBBPByteOrder.LITTLE_ENDIAN)); }
@Test public void testReadUnsignedShort_EOFforOneByte_BigEndian_EOFException() throws Exception { assertThrows(EOFException.class, () -> asInputStream((byte) 1).readUnsignedShort(JBBPByteOrder.BIG_ENDIAN)); }
@Test public void testReadUnsignedShort_EOFforOneByte_LittleEndian_EOFException() throws Exception { assertThrows(EOFException.class, () -> asInputStream((byte) 1).readUnsignedShort(JBBPByteOrder.LITTLE_ENDIAN)); }
@Test public void testReadUnsignedShort_BigEndian() throws Exception { assertEquals(0x1234, asInputStream(0x12, 0x34).readUnsignedShort(JBBPByteOrder.BIG_ENDIAN)); }