private byte[] getData(File file) { if (null != file) { try { return ArchiveUtil.inputStreamToBytes(file.getInputStream()); } catch (FileNotFoundException e) { return null; } catch (IOException e) { throw new ArchiveRuntimeException(CommonArchiveResourceHandler.getString(CommonArchiveResourceHandler.io_ex_loading_EXC_, (new Object[]{file.getName()})), e); // = "An IO exception occurred loading " } } } return null; }
public void save(File aFile, InputStream in) throws SaveFailureException { try { progressMonitor.subTask(aFile.getURI()); IPath projectRelativePath = getOutputPathForFile(aFile); if (aFile.isArchive()) { saveAsArchiveComponent((Archive) aFile, projectRelativePath, in); } else if (!aFile.isDirectoryEntry()) { saveToOutputPath(projectRelativePath, in); } else { createDirectory(projectRelativePath); } } catch (OverwriteHandlerException ohe) { throw ohe; } catch (Exception e) { String errorString = EJBArchiveOpsResourceHandler.ARCHIVE_OPERATION_SaveFile + aFile.getName(); throw new SaveFailureException(errorString, e); } finally { progressMonitor.worked(1); } }