Added a read(InputStream) method and refactored read(URL) to use it.