Bug 82804 Jar creation should use less memory
I noticed that the JarWriter will read the entire file it plans to store into memory. An optimization would be to stream the file directly into the JarOutputStream. The only catch is with STORED items which need the CRC32 computed. A penalty could be taken in that case to compute the CRC in a loop and then stream the file.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/jarpackager/JarPackageData.java
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.jarpackager.JarFileExportOperation;
import org.eclipse.jdt.internal.ui.jarpackager.JarPackageReader;
import org.eclipse.jdt.internal.ui.jarpackager.JarPackageWriter;
import org.eclipse.jdt.internal.ui.jarpackager.JarPackagerUtil;
import org.eclipse.jdt.internal.ui.jarpackager.ManifestProvider;
import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
/**
 * Model for a JAR package. Describes a JAR package including a bunch of
 * useful options to generate a JAR file with a JAR writer.
 * 
 * Clients may subclass.
 * 
 * @see org.eclipse.jdt.ui.jarpackager.JarWriter
 * @since 2.0
 */
public class JarPackageData {
	private String	fManifestVersion;
	/*
	 * What to export - internal locations
	 * The list fExported* is null if fExport* is false)
	 */	
	private boolean fExportClassFiles;	
	private boolean fExportOutputFolders;	
	private boolean fExportJavaFiles;		
	/*
	 * Source folder hierarchy is created in the JAR if true
	 */
	private boolean fUseSourceFolderHierarchy;