Exemplo n.º 1
0
 public static byte[] readFile(String file) throws JDependException {
   FileInputStream fis = null;
   try {
     fis = new FileInputStream(file);
     return StreamUtil.getData(fis);
   } catch (FileNotFoundException e) {
     e.printStackTrace();
     throw new JDependException(e);
   } finally {
     if (fis != null) {
       try {
         fis.close();
       } catch (IOException e) {
         e.printStackTrace();
       }
     }
   }
 }
Exemplo n.º 2
0
  public static byte[] getFileData(String fileName) throws JDependException {

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

    FileInputStream fis = null;
    try {
      fis = new FileInputStream(fileName);
      return StreamUtil.getData(fis);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
      LogUtil.getInstance(FileUtil.class).systemError("文件[" + fileName + "]没有发现。");
      throw new JDependException("文件[" + fileName + "]读取失败。", e);
    } finally {
      try {
        if (fis != null) {
          fis.close();
        }
      } catch (IOException ignore) {
      }
    }
  }