Code example for ZipEntry

Methods: setCompressedSizesetCrcsetMethodsetSize

0
	        // Add ZIP entry to output stream. 
			if (part instanceof OleObjectBinaryPart) {
				// Workaround: Powerpoint 2010 (32-bit) can't play eg WMV if it is compressed! 
				// (though 64-bit version is fine) 
				 
				ZipEntry ze = new ZipEntry(resolvedPartUri);
				ze.setMethod(ZipOutputStream.STORED);
				 
				// must set size, compressed size, and crc-32 
				ze.setSize(bytes.length);
				ze.setCompressedSize(bytes.length);
				 
			    CRC32 crc = new CRC32();
			    crc.update(bytes);	
			    ze.setCrc(crc.getValue());
				 
				zos.putNextEntry(ze);				
			} else { 
				zos.putNextEntry(new ZipEntry(resolvedPartUri));
			} 
Experience pair programming with AI  Get Codota for Java