StreamUtil { public static String toString(InputStream inputStream) throws IOException { return toString(inputStream, StringPool.UTF8); }  static void cleanUp(Closeable... closeables); static byte[] toByteArray(InputStream inputStream); static String toString(InputStream inputStream); static String toString(InputStream inputStream, String charsetName); static void transfer(
			InputStream inputStream, OutputStream outputStream); static void transfer(
			InputStream inputStream, OutputStream outputStream, boolean cleanUp); static void transfer(
			InputStream inputStream, OutputStream outputStream, int bufferSize); static void transfer(
			InputStream inputStream, OutputStream outputStream, int bufferSize,
			boolean cleanUp); static void transfer(
			InputStream inputStream, OutputStream outputStream, int bufferSize,
			boolean cleanUp, long length); static void transfer(
			InputStream inputStream, OutputStream outputStream, long length); static final int BUFFER_SIZE; static final boolean FORCE_TIO; }
@Test public void testToString() throws IOException { Assert.assertNull(StreamUtil.toString(null)); String s = "Hello World"; byte[] uft8EncodedBytes = s.getBytes(StringPool.UTF8); Assert.assertEquals( s, StreamUtil.toString( new UnsyncByteArrayInputStream(uft8EncodedBytes))); s = "测试"; byte[] gb2312EncodedBytes = s.getBytes("GB2312"); Assert.assertEquals( s, StreamUtil.toString( new UnsyncByteArrayInputStream(gb2312EncodedBytes), "GB2312")); Assert.assertNotEquals( s, StreamUtil.toString( new UnsyncByteArrayInputStream(gb2312EncodedBytes))); }