public java.util.List filterFilesWithoutPrefix(String[] prefixes) { List subset = new ArrayList(); List theFiles = getFiles(); for (int i = 0; i < theFiles.size(); i++) { File aFile = (File) theFiles.get(i); if (aFile.isDirectoryEntry()) continue; boolean shouldAdd = true; for (int j = 0; j < prefixes.length; j++) { if (aFile.getURI().startsWith(prefixes[j])) { shouldAdd = false; break; } } if (shouldAdd) subset.add(aFile); } return subset; }
public java.util.List filterFiles(String prefix, String[] suffixes) { List subset = new ArrayList(); List theFiles = getFiles(); for (int i = 0; i < theFiles.size(); i++) { File aFile = (File) theFiles.get(i); if (!aFile.isDirectoryEntry() && aFile.getURI().startsWith(prefix)) if (suffixes == null || hasSuffix(aFile.getURI(), suffixes)) subset.add(aFile); } return subset; }
public void save(File aFile, InputStream in) throws SaveFailureException { try { String entryName = aFile.getURI(); if (aFile.isDirectoryEntry() && !entryName.endsWith("/"))//$NON-NLS-1$ entryName = entryName + '/'; ZipEntry entry = new ZipEntry(entryName); if (aFile.getLastModified() > 0) entry.setTime(aFile.getLastModified()); getZipOutputStream().putNextEntry(entry); if (!aFile.isDirectoryEntry()) { org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil.copy(in, getZipOutputStream()); } getZipOutputStream().closeEntry(); } catch (IOException iox) { throw new SaveFailureException(aFile.getURI(), iox); } }
/** * @see com.ibm.etools.archive.impl.SaveStrategyImpl */ public void save(org.eclipse.jst.j2ee.commonarchivecore.internal.File aFile, InputStream in) throws SaveFailureException { String entryName = aFile.getURI(); if (aFile.isDirectoryEntry()) mkdirs(entryName); else { try { OutputStream out = getUriConverter().createOutputStream(URI.createURI(entryName)); org.eclipse.jst.j2ee.commonarchivecore.internal.util.ArchiveUtil.copy(in, out); } catch (IOException iox) { throw new SaveFailureException(aFile.getURI(), iox); } } }
/** * @see com.ibm.etools.archive.impl.SaveStrategyImpl */ public void save(org.eclipse.jst.j2ee.commonarchivecore.internal.File aFile, InputStream in) throws SaveFailureException { String entryName = aFile.getURI(); if (aFile.isDirectoryEntry()) mkdirs(entryName); else { try { OutputStream out = getUriConverter().createOutputStream(URI.createURI(entryName)); ArchiveUtil.copy(in, out); setTimestampAfterSaving(aFile); } catch (IOException iox) { throw new SaveFailureException(aFile.getURI(), iox); } } }
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); } }
/** * @see com.ibm.etools.archive.SaveStrategy */ public void save(File aFile, FileIterator iterator) throws SaveFailureException { if (aFile.isArchive() && shouldIterateOver((Archive) aFile)) save((Archive) aFile); else { InputStream in = null; if (!aFile.isDirectoryEntry()) { try { in = iterator.getInputStream(aFile); } catch (IOException ex) { throw new SaveFailureException(aFile.getURI(), ex); } } save(aFile, in); } }