stream转byte[]记录,下次直接用 private static byte[] steamToByte(InputStream input) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); int len = 0; byte[] b = new byte[1024]; while ((len = input.read(b, 0, b.length)) != -1) { baos.write(b, 0, len); } byte[] buffer = baos.toByteArray(); return buffer; }
java stream转byte[ ]
最新推荐文章于 2024-06-11 15:49:24 发布