PS the code above could leak the InputStream or the Readers.  It needs a try finally or two...