Example usage for java.util.jar JarEntry setExtra

List of usage examples for java.util.jar JarEntry setExtra

Introduction

In this page you can find the example usage for java.util.jar JarEntry setExtra.

Prototype

public void setExtra(byte[] extra) 

Source Link

Document

Sets the optional extra field data for the entry.

Usage

From source file:com.germinus.easyconf.FileUtil.java

public static void writeAsJAR(File dest, String propsFileName, Properties props)
        throws FileNotFoundException, IOException {
    JarOutputStream out = new JarOutputStream(new FileOutputStream(dest));
    JarEntry propertiesFile = new JarEntry(propsFileName);
    propertiesFile.setExtra(propertiesToString(props).getBytes());
    out.putNextEntry(propertiesFile);/*  w  w  w.  j  a  v a 2  s .  c  o  m*/
    out.close();
}

From source file:org.apache.pluto.util.assemble.io.JarStreamingAssembly.java

private static JarEntry smartClone(JarEntry originalJarEntry) {
    final JarEntry newJarEntry = new JarEntry(originalJarEntry.getName());
    newJarEntry.setComment(originalJarEntry.getComment());
    newJarEntry.setExtra(originalJarEntry.getExtra());
    newJarEntry.setMethod(originalJarEntry.getMethod());
    newJarEntry.setTime(originalJarEntry.getTime());

    //Must set size and CRC for STORED entries
    if (newJarEntry.getMethod() == ZipEntry.STORED) {
        newJarEntry.setSize(originalJarEntry.getSize());
        newJarEntry.setCrc(originalJarEntry.getCrc());
    }//from w  ww  .  ja v  a 2  s . c  om

    return newJarEntry;
}

From source file:org.jahia.modules.serversettings.portlets.BasePortletHelper.java

static JarEntry cloneEntry(JarEntry originalJarEntry) {
    final JarEntry newJarEntry = new JarEntry(originalJarEntry.getName());
    newJarEntry.setComment(originalJarEntry.getComment());
    newJarEntry.setExtra(originalJarEntry.getExtra());
    newJarEntry.setMethod(originalJarEntry.getMethod());
    newJarEntry.setTime(originalJarEntry.getTime());

    // Must set size and CRC for STORED entries
    if (newJarEntry.getMethod() == ZipEntry.STORED) {
        newJarEntry.setSize(originalJarEntry.getSize());
        newJarEntry.setCrc(originalJarEntry.getCrc());
    }//w  ww.j ava 2s.  c  om

    return newJarEntry;
}