コード例 #1
0
ファイル: FileUtil.java プロジェクト: jdepend/cooper
  public static void createFile(String filePath, Properties properties) throws JDependException {

    assert filePath != null && filePath.length() != 0;

    createFile(filePath);
    saveFileContent(filePath, properties);
  }
コード例 #2
0
ファイル: FileUtil.java プロジェクト: jdepend/cooper
 public static void saveFile(String filePath, byte[] data) throws JDependException {
   createFile(filePath);
   FileOutputStream fis = null;
   try {
     fis = new FileOutputStream(filePath);
     fis.write(data);
   } catch (FileNotFoundException e) {
     e.printStackTrace();
     throw new JDependException("文件[" + filePath + "]保存失败。", e);
   } catch (IOException e) {
     e.printStackTrace();
     throw new JDependException("文件[" + filePath + "]保存失败。", e);
   } finally {
     if (fis != null) {
       try {
         fis.close();
       } catch (IOException e) {
         e.printStackTrace();
       }
     }
   }
 }