FileOutputStream fis = new FileOutputStream("C:/xxx.xxx");
ByteArrayInputStream bais = new ByteArrayInputStream(b);
byte[] buffer = new byte[8*1024];
int count = 0;
while ((count = bais.read(buffer)) != 0)
fis.write(buffer, 0, count);
fis.close();
调试欢乐多
fileByte.put("附件名1", byte[]字节类型);
fileByte.put("附件名2", byte[]字节类型); 怎样把HashMap中的“byte[]字节类型“结合以下代码生成文件?
FileOutputStream fis = new FileOutputStream("C:/xxx.xxx");
ByteArrayInputStream bais = new ByteArrayInputStream(b);
byte[] buffer = new byte[8*1024];
int count = 0;
while ((count = bais.read(buffer)) != 0)
fis.write(buffer, 0, count);
fis.close();
FileOutputStream fis = new FileOutputStream("C:/xxx.xxx");
ByteArrayInputStream bais = new ByteArrayInputStream(b);
byte[] buffer = new byte[8*1024];
int count = 0;
while ((count = bais.read(buffer)) != 0)
fis.write(buffer, 0, count);
fis.close(); 红字部分就是你取出的字节数组.
fileByte.put("附件名1", byte[]字节类型);
fileByte.put("附件名2", byte[]字节类型);
String fjName="";
String keyValue="";
Iterator keyIter= fileData.keySet().iterator();
while(keyIter.hasNext()){
keyValue=(String)keyIter.next();
byte[] b = fileData.get(keyValue);
FileOutputStream fis = new FileOutputStream("C:/xxx.xxx");
ByteArrayInputStream bais = new ByteArrayInputStream(b);
byte[] buffer = new byte[8*1024];
int count = 0;
while ((count = bais.read(buffer)) != 0)
fis.write(buffer, 0, count);
fis.close();
}