Sometimes the platform default charset is appropriate. Like when you're turning

the results of Process.getOutputStream() into a string.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@2592 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
samskivert
2009-07-13 02:21:06 +00:00
parent 80ccf8dd16
commit b5af1884b3
@@ -114,6 +114,15 @@ public class StreamUtil
return copy(stream, new ByteArrayOutputStream()).toByteArray();
}
/**
* Reads the contents of the supplied stream into a string using the platform default charset.
*/
public static String toString (InputStream stream)
throws IOException
{
return copy(stream, new ByteArrayOutputStream()).toString();
}
/**
* Reads the contents of the supplied stream into a string using the supplied {@link Charset}.
*/