Code example for ZipEntry

Methods: setExtra

0
    zipFile.close();
  } 
 
  public void testTooLongExtra() throws Exception {
    byte[] tooLongExtra = new byte[65536];
    ZipEntry ze = new ZipEntry("x");
    try { 
      ze.setExtra(tooLongExtra);
      fail();
    } catch (IllegalArgumentException expected) {
    } 
  } 
 
  public void testMaxLengthExtra() throws Exception {
    byte[] maxLengthExtra = new byte[65535];
 
    File f = createTemporaryZipFile();
    ZipOutputStream out = createZipOutputStream(f);
    ZipEntry ze = new ZipEntry("x");
    ze.setExtra(maxLengthExtra);
Experience pair programming with AI  Get Codota for Java