图片流操作:












如果不是图片:
jar包是uploadbean.jar
UploadBean 使用的是javazoom.upload.UploadBean
String filename = user.getUserName() + Constant.getDate() + ".lst"; //信息索引文件
String bodyFileName = Constant.getDate() + ".tel"; //电话文件
String messageFileName = Constant.getDate() + ".txt"; //彩信的文本内容。
String pictureName = Constant.getDate() +filePostfix ; //图片名称
UploadBean upload = new UploadBean();
upload.setParser(MultipartFormDataRequest.COSPARSER);
upload.setWhitelist(Constant.WHITELIST);
upload.setFolderstore(Constant.PATH);
telStr = strBuff.toString().trim();
FileOutputStream bodyfos = new FileOutputStream(new File(Constant.PATH, bodyFileName));
BufferedWriter bodytbw = new BufferedWriter(new OutputStreamWriter(bodyfos, "GBK"));
bodytbw.write("\"" + telStr + "\"");
bodytbw.flush();
bodytbw.close();
bodyfos.close();
生成的文件名称有中文。
FileOutputStream fos = new FileOutputStream(new File(Constant.PATH, new String(filename.getBytes("GBK"))));
BufferedWriter stdout = new BufferedWriter(new OutputStreamWriter(fos, "GBK"));
stdout.write(sb.toString());//sb.toString()是写入文件的内容。
stdout.flush();
stdout.close();
fos.close();