Why read this into a ByteArrayInputStream?  Why not just get the characters in the String and iterate over them?  This seems like overkill