diff --git a/src/java/com/samskivert/io/StreamUtil.java b/src/java/com/samskivert/io/StreamUtil.java index 1912b22b..2ee5c7ea 100644 --- a/src/java/com/samskivert/io/StreamUtil.java +++ b/src/java/com/samskivert/io/StreamUtil.java @@ -105,6 +105,15 @@ public class StreamUtil return out; } + /** + * Reads the contents of the supplied stream into a byte array. + */ + public static byte[] toByteArray (InputStream stream) + throws IOException + { + return copy(stream, new ByteArrayOutputStream()).toByteArray(); + } + /** * Reads the contents of the supplied stream into a string using the supplied {@link Charset}. */