replaced deprecated StringBufferInputStream class with ByteArrayInputStream