Obtenir des fichiers zip 32 bits en utilisant Java 64 bits
Lorsque je zip des fichiers en utilisant Java 64 bits, le fichier zip apparaît comme vide sous Windows 7. Existe-t-il un moyen de forcer la version 32 bits de zip en utilisant Java 64 bits?
MODIFIER: Je peux l'ouvrir / décompresser en utilisant des outils tiers comme BeyondCompare. Lorsque je parcourt ce fichier via Windows 7, le contenu est vide. Le décompresser à l'aide de Win 7 me donne une erreur "Fichier zip invalide".
public static void zipFiles(Collection<String> fileLocations, String targetZipFile){
if( fileLocations == null || fileLocations.size() <= 0 ){
return;
}
byte[] buffer = new byte[1024];
try{
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(targetZipFile));
FileInputStream in = null;
String fileName = null;
for( String fileLoc : fileLocations ){
fileName = fileLoc.substring(fileLoc.lastIndexOf(File.separator));
// Add ZIP entry to output stream.
out.putNextEntry(new ZipEntry(fileName));
in = new FileInputStream(fileLoc);
int len;
while ((len = in.read(buffer)) > 0) {
out.write(buffer, 0, len);
}
// Complete the entry
out.closeEntry();
in.close();
}
// Complete the ZIP file
out.close();
}catch(IOException ioe){
LOGGER.error(ioe.getMessage(),ioe);
}
}
0
Author: user2793390, 2014-03-15