I think `instanceof ByteArrayInputStream` is not safe because in could be an instance of extended type of ByteArrayInputStream which overrides `read(byte[])` method.
This is safe: `ByteArrayInputStream.class.equals(in.getClass())`