inputStreamUtil
public class InputStreamUtil {/** * 读取流中的数据转换为byte数组 * @param in * @return * @throws Exception */public static byte[] getBytes(InputStream in) throws Exception{ByteArrayOutputStream byteOs = new ByteArrayOutputStream();int data = 0;try {while ((data = in.read()) != -1) {byteOs.write(data);}} catch (Exception e) {throw e;}return byteOs.toByteArray();}}
页:
[1]