diff options
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/io/IOUtils.java')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/io/IOUtils.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/io/IOUtils.java b/vespajlib/src/main/java/com/yahoo/io/IOUtils.java index a5e16fc89ea..2572842b213 100644 --- a/vespajlib/src/main/java/com/yahoo/io/IOUtils.java +++ b/vespajlib/src/main/java/com/yahoo/io/IOUtils.java @@ -14,9 +14,10 @@ import java.nio.ByteBuffer; * <p>Some static io convenience methods.</p> * * @author bratseth - * @author <a href="mailto:borud@yahoo-inc.com">Bjorn Borud</a> + * @author Bjorn Borud */ public abstract class IOUtils { + static private final Charset utf8Charset = Charset.forName("utf-8"); /** Closes a writer, or does nothing if the writer is null */ @@ -410,6 +411,11 @@ public abstract class IOUtils { return ret.toString(); } + /** Read an input stream completely into a string */ + public static String readAll(InputStream stream, Charset charset) throws IOException { + return readAll(new InputStreamReader(stream, charset)); + } + /** Convenience method for closing a list of readers. Does nothing if the given reader list is null. */ public static void closeAll(List<Reader> readers) { if (readers==null) return; |