日期:2014-05-20  浏览次数:20614 次

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