### Question:
BinaryDecoder extends Decoder { protected BinaryDecoder() { } protected  BinaryDecoder();   BinaryDecoder(InputStream in, int bufferSize);   BinaryDecoder(byte[] data, int offset, int length); @Override void readNull(); @Override boolean readBoolean(); @Override int readInt(); @Override long readLong(); @Override float readFloat(); @Override double readDouble(); @Override Utf8 readString(Utf8 old); @Override String readString(); @Override void skipString(); @Override ByteBuffer readBytes(ByteBuffer old); @Override void skipBytes(); @Override void readFixed(byte[] bytes, int start, int length); @Override void skipFixed(int length); @Override int readEnum(); @Override long readArrayStart(); @Override long arrayNext(); @Override long skipArray(); @Override long readMapStart(); @Override long mapNext(); @Override long skipMap(); @Override int readIndex(); boolean isEnd(); InputStream inputStream();  }### Answer:
@Test public void testDecodeFromSources() throws IOException { GenericDatumReader<Object> reader = new GenericDatumReader<>(); reader.setSchema(schema); ByteArrayInputStream is = new ByteArrayInputStream(data); ByteArrayInputStream is2 = new ByteArrayInputStream(data); ByteArrayInputStream is3 = new ByteArrayInputStream(data); Decoder fromInputStream = newDecoder(is); Decoder fromArray = newDecoder(data); byte[] data2 = new byte[data.length + 30]; Arrays.fill(data2, (byte) 0xff); System.arraycopy(data, 0, data2, 15, data.length); Decoder fromOffsetArray = newDecoder(data2, 15, data.length); BinaryDecoder initOnInputStream = factory.binaryDecoder(new byte[50], 0, 30, null); initOnInputStream = factory.binaryDecoder(is2, initOnInputStream); BinaryDecoder initOnArray = factory.binaryDecoder(is3, null); initOnArray = factory.binaryDecoder(data, 0, data.length, initOnArray); for (Object datum : records) { Assert.assertEquals("InputStream based BinaryDecoder result does not match", datum, reader.read(null, fromInputStream)); Assert.assertEquals("Array based BinaryDecoder result does not match", datum, reader.read(null, fromArray)); Assert.assertEquals("offset Array based BinaryDecoder result does not match", datum, reader.read(null, fromOffsetArray)); Assert.assertEquals("InputStream initialized BinaryDecoder result does not match", datum, reader.read(null, initOnInputStream)); Assert.assertEquals("Array initialized BinaryDecoder result does not match", datum, reader.read(null, initOnArray)); } }