首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java相关 >

InputStream怎么导入byte[] 的内容

2012-04-25 
InputStream如何导入byte[] 的内容?现有: ?InputStream inStream和: ?byte[] bufinStream 如何导入 buf

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... 

热点排行