根据BLOB生成一个附件,首先判断该附件是否已经存在,如果不存在继续生成附件
public isexists(){
String tempFilePath="附件路径";
byte[] fileStream = "附件数据流";
File tempFile = new File(tempFilePath);
//判断路径是否存在
if(!tempFile.exists()){
//获取附件的路径并生成文件夹
File file2=new File(tempFile.getParent());
file2.mkdirs();
//判断附件是否存在,如果不存在创建文件夹
if(tempFile.isDirectory()){
}else{
tempFile.createNewFile();//创建文件
//BLOB数据存放到附件中
FileOutputStream os = new FileOutputStream(tempFilePath);
os.write(fileStream);
os.close();
}
}