现在的位置: 首页 > 综合 > 正文

一些搜集的实用方法

2013年04月11日 ⁄ 综合 ⁄ 共 276字 ⁄ 字号 评论关闭

Java InputStream 转 Byte

public byte[] InputStreamToByte(InputStream iStrm) throws IOException {
ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
int ch;
while ((ch = iStrm.read()) != -1)
{
bytestream.write(ch);
}
byte imgdata[]=bytestream.toByteArray();
bytestream.close();
return imgdata;

 

抱歉!评论已关闭.