下面是我写的一个方法,传入一个byte[],生成一个文件保存到磁盘上,执行后文件保存了,但大小为0,为啥啊?
  public String saveWordtoDisk(byte[] docbyte) throws IOException {
  String id="";
  Tools tools = new Tools();
  id = tools.getSerialID();
  String filepath = common.EdoasKit.getInstance().getAttachmentFilePath() + id;
  try{
    File file = new File(filepath);
    FileOutputStream fos = new FileOutputStream(file);
    int size = docbyte.length;
    System.out.println("docbyte.size====" + size );
    fos.write(docbyte,0,size);
    fos.close();
    System.out.println("saveWordtoDisk returnid==== " + id);
    return id;
    } 
  catch(Exception ex){
    return "0";
    }
}