Code example for JarEntry

Methods: setMethod

0
		this.name = name;
		this.file = file;
	} 
 
	public void writeTo(JarOutputStream out) throws IOException {
		JarEntry entry = new JarEntry(name);
		entry.setMethod(ZipEntry.DEFLATED);
		out.putNextEntry(entry);
 
		if( file != null)
			writeFile(out);
 
		out.closeEntry();
	} 
 
	private void writeFile( JarOutputStream out ) throws IOException {
		byte[] fileContent = FileUtils.readFileToByteArray(file);
		out.write(fileContent);
	} 
 
Contextual code suggestions in your IDE  Get Codota for Java