Bonjour,

J'ai un repertoire de fichiers que j'aimerai zipper:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
......................Repertoire1
....................................SousRep1
...................................................monfichier1
...................................................monfichier2
...................................................monfichier3
....................................SousRep2
...................................................monfichier1
...................................................monfichier2
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
private void zipOutputDirectory(String CHEMIN) {
	Utilitaires.listDirectoryAtraiter(CHEMIN_WS+File.separator+CHEMIN_REPERTOIRE1);
		ZipEntry(CHEMIN_WS+File.separator+CHEMIN_REPERTOIRE1);
		String zipFileName = "Test"+CHEMIN;
		try {
			ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(zipFileName));
			zip.setMethod(ZipOutputStream.DEFLATED);
			zip.setLevel(Deflater.BEST_COMPRESSION);
			File dataDirectories = new File("conf"+File.separator+CHEMIN+File.separator+CHEMIN_REPERTOIRE1);
			String[] listFile = dataDirectories.list();
			zipDirectory(dataDirectories, zip);
			zip.close();
			} catch (FileNotFoundException fileNotFound) {
				}
			catch (IOException io) {
				}	
		}
 
	private void zipDirectory(File directory, ZipOutputStream zip) {
		String[] listFile = directory.list();
		for (int i = 0; i < listFile.length; i++) {
		try {
		File file = new File(directory.getPath()+File.separator+listFile[i]);
		if (file.isDirectory()) zipDirectory(file, zip);
		else {
		FileInputStream in = new FileInputStream(file);
		byte[] bytes = new byte[in.available()];
		in.read(bytes);
		in.close();
 
		ZipEntry entry = new ZipEntry(file.getPath());
		entry.setTime(file.lastModified());
		zip.putNextEntry(entry);
		zip.write(bytes);
		zip.closeEntry();
		}
		} catch (FileNotFoundException fileNotFound) {}
		catch (IOException io) {}
		}
		}
J'ai un fichier crée avec le nom TestService où service est le "CHEMIN". Ce fichier n'est pa sun fichier zip. Il n'a tout simplement pas d'extension. Et il se trouve au même niveau que le repertoire /conf ( en rouge dans le code )

Quelqu'un aurait-il une idée svp?
Merci