### Question:
StreamUtil { public final static byte[] inputStream2Byte(InputStream inStream) throws Exception { int count = 0; while (count == 0) { count = inStream.available(); } byte[] b = new byte[count]; inStream.read(b); return b; }  final static String streamToString(InputStream in); final static byte[] stream2Byte(InputStream is); final static byte[] inputStream2Byte(InputStream inStream); final static InputStream byte2InputStream(byte[] b); final static void streamSaveAsFile(InputStream is, File outfile);  }### Answer:
@Test public void testInputStream2Byte() throws Exception { String str = "中文"; InputStream in = StreamUtil.byte2InputStream(str.getBytes(Opslab.UTF_8)); byte[] bt = StreamUtil.inputStream2Byte(in); assertEquals(str, new String(bt)); }