public class StreamUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String[] |
asLines(InputStream is)
Returns all the lines read from an input stream.
|
static String |
asString(InputStream is)
Returns the string content of a stream, new line chars will be removed.
|
static String |
asString(InputStream is,
boolean preserveNL)
Returns the string content of a stream.
|
static void |
closeGracefully(Closeable closable)
Closes the closable interface and reports error if any.
|
public static String[] asLines(InputStream is) throws IOException
is
- input stream.null
lines.IOException
public static String asString(InputStream is, boolean preserveNL) throws IOException
is
- input stream.preserveNL
- preserves new line chars.IOException
- if an error occurs while consuming the is
stream.public static String asString(InputStream is) throws IOException
is
- input stream.IOException
- if an error occurs while consuming the is
stream.public static void closeGracefully(Closeable closable)
closable
- the closable object to be closed.Copyright © 2010-2013 The Apache Software Foundation. All Rights Reserved.