读书人

InputStream怎么导入byte[] 的内容

发布时间: 2012-04-25 19:32:32 作者: rapoo

InputStream如何导入byte[] 的内容?
现有:
? InputStream inStream;
和:
? byte[] buf;

inStream 如何导入 buf 的内容?


[解决办法]
用ByteArrayInputStream();
for example

Java code
byte[] buf = {...};ByteArrayInputStream bis = new ByteArrayInputStream(buf);InputStream inStream;inStream = bis; //or inStream = new DataInputStream(bis); //so on... 

读书人网 >Java相关

热点推荐