通过ByteArrayOutputStream将inputStream转变为outputStream(6)
来源:未知 责任编辑:责任编辑 发表时间:2015-10-08 14:15 点击:次
InputStream inputStream = ops();
ByteArrayOutputStream baos = castToBAOStream(inputStream,StreamFlushBufferSzie);
InputStream is = new ByteArrayInputStream(baos.toByteArray());
File file=new File("d://new.txt");
FileOutputStream outb=new FileOutputStream(file);
int bytesRead;
byte[] buf = new byte[4 * 1024];
while((bytesRead = is.read(buf))!=-1){
outb.write(buf,0,bytesRead);
}
outb.flush();
outb.close();
is.close();
System.out.println(inputStream);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>