/** * Read and return the entire contents of the supplied {@link Reader}. This method always closes the reader when finished * reading. * * @param reader the reader of the contents; may be null * @return the contents, or an empty string if the supplied reader is null * @throws IOException if there is an error reading the content */ public static String read( Reader reader ) throws IOException { return IoUtil.read(reader); }
/** * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished * reading. * * @param stream the streamed contents; may be null * @return the contents, or an empty string if the supplied stream is null * @throws IOException if there is an error reading the content */ public static String read( InputStream stream ) throws IOException { return IoUtil.read(stream); }
/** * Read and return the entire contents of the supplied {@link InputStream}. This method always closes the stream when finished * reading. * * @param stream the streamed contents; may be null * @return the contents, or an empty string if the supplied stream is null * @throws IOException if there is an error reading the content */ public static String read( InputStream stream ) throws IOException { return stream == null ? "" : read(new InputStreamReader(stream)); }
List<String> lines = null; try { String content = IoUtil.read(stream); lines = StringUtil.splitLines(content); } catch (IOException e) {