/** * Write the FormDef to the file system as a binary blog. * * @param filepath * path to the form file */ public void serializeFormDef(FormDef fd, String filepath) { // calculate unique md5 identifier String hash = FileUtils.getMd5Hash(new File(filepath)); File formDef = new File(Collect.CACHE_PATH + File.separator + hash + ".formdef"); // formdef does not exist, create one. if (!formDef.exists()) { FileOutputStream fos; try { fos = new FileOutputStream(formDef); DataOutputStream dos = new DataOutputStream(fos); fd.writeExternal(dos); dos.flush(); dos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }