184 entries.add(new Entry("meta-iNf/ManIfEst.Mf",
185 ZipEntry.STORED,
186 toBytes("maNiFest-VeRsIon: 1.0\n"),
187 toExtra(toBytes("Can manifests have extra??")),
188 "Can manifests have comments??"));
189
190 // The emptiest possible entry
191 entries.add(new Entry("", ZipEntry.STORED, null, null, ""));
192
193 for (String name : names)
194 for (int method : methods)
195 for (byte[] data : datas) // datae??
196 for (byte[] extra : extras)
197 for (String comment : comments)
198 entries.add(new Entry(uniquify(name), method, data,
199 toExtra(extra), comment));
200
201 //----------------------------------------------------------------
202 // Write zip file using ZipOutputStream
203 //----------------------------------------------------------------
204 ZipOutputStream zos = new ZipOutputStream(
205 new FileOutputStream(zipName));
206
207 for (Entry e : entries)
208 e.write(zos);
209
210 zos.close();
211
212 //----------------------------------------------------------------
213 // Verify zip file contents using JarFile class
214 //----------------------------------------------------------------
215 JarFile f = new JarFile(zipName);
216
217 check(f.getManifest() != null);
218
219 for (Entry e : entries)
220 e.verify(f);
221
222 f.close();
223
224 //----------------------------------------------------------------
225 // Verify zip file contents using JarInputStream class
226 //----------------------------------------------------------------
227 JarInputStream jis = new JarInputStream(
228 new FileInputStream(zipName));
229
230 // JarInputStream "automatically" reads the manifest
|
184 entries.add(new Entry("meta-iNf/ManIfEst.Mf",
185 ZipEntry.STORED,
186 toBytes("maNiFest-VeRsIon: 1.0\n"),
187 toExtra(toBytes("Can manifests have extra??")),
188 "Can manifests have comments??"));
189
190 // The emptiest possible entry
191 entries.add(new Entry("", ZipEntry.STORED, null, null, ""));
192
193 for (String name : names)
194 for (int method : methods)
195 for (byte[] data : datas) // datae??
196 for (byte[] extra : extras)
197 for (String comment : comments)
198 entries.add(new Entry(uniquify(name), method, data,
199 toExtra(extra), comment));
200
201 //----------------------------------------------------------------
202 // Write zip file using ZipOutputStream
203 //----------------------------------------------------------------
204 try (FileOutputStream fos = new FileOutputStream(zipName);
205 ZipOutputStream zos = new ZipOutputStream(fos))
206 {
207 for (Entry e : entries)
208 e.write(zos);
209 }
210
211 //----------------------------------------------------------------
212 // Verify zip file contents using JarFile class
213 //----------------------------------------------------------------
214 JarFile f = new JarFile(zipName);
215
216 check(f.getManifest() != null);
217
218 for (Entry e : entries)
219 e.verify(f);
220
221 f.close();
222
223 //----------------------------------------------------------------
224 // Verify zip file contents using JarInputStream class
225 //----------------------------------------------------------------
226 JarInputStream jis = new JarInputStream(
227 new FileInputStream(zipName));
228
229 // JarInputStream "automatically" reads the manifest
|