读书人

怎么将一个文件中的所有数据放到一个B

发布时间: 2011-12-02 23:47:57 作者: rapoo

如何将一个文件中的所有数据放到一个ByteArrayInputStream阿?
二进制方式打开文件, 想把数据放到 ByteArrayInputStream

求教!

[解决办法]
public static void main(String[] args) throws IOException {
byte[] bs = new byte[1024 * n];
int count = new FileInputStream( "file path ").read(bs);
ByteArrayInputStream bip = new ByteArrayInputStream(bs, 0, count);
}

读书人网 >J2SE开发

热点推荐