Code example for JarEntry

Methods: setMethodsetTime

0
 
	private void addFile(File file, IPath path) throws IOException {
		if (fJarPackage.areDirectoryEntriesIncluded())
			addDirectories(path);
 
		JarEntry newEntry= new JarEntry(path.toString().replace(File.separatorChar, '/'));
 
		if (fJarPackage.isCompressed())
			newEntry.setMethod(ZipEntry.DEFLATED);
			// Entry is filled automatically. 
		else { 
			newEntry.setMethod(ZipEntry.STORED);
			JarPackagerUtil.calculateCrcAndSize(newEntry, new FileInputStream(file), new byte[4096]);
		} 
 
		newEntry.setTime(file.lastModified());
		addEntry(newEntry, new FileInputStream(file));
	} 
}