List of usage examples for org.apache.commons.compress.archivers.tar TarArchiveEntry setUserId
public void setUserId(int userId)
From source file:org.vafer.jdeb.producers.Producers.java
/** * Creates a tar directory entry with defaults parameters. * @param dirName the directory name/* w w w . j a v a 2 s . c om*/ * @return dir entry with reasonable defaults */ static TarArchiveEntry defaultDirEntryWithName(final String dirName) { TarArchiveEntry entry = new TarArchiveEntry(dirName, true); entry.setUserId(ROOT_UID); entry.setUserName(ROOT_NAME); entry.setGroupId(ROOT_UID); entry.setGroupName(ROOT_NAME); entry.setMode(TarArchiveEntry.DEFAULT_DIR_MODE); return entry; }
From source file:org.xenmaster.web.SetupHook.java
protected void writePluginsToTarball(TarArchiveOutputStream tos) throws IOException { File f = new File("store/xapi/plugins"); if (!f.exists() || !f.isDirectory()) { throw new IOException("Plugin directory is not present"); }/*from w w w . j a v a 2 s . c o m*/ for (File plugin : f.listFiles()) { TarArchiveEntry tae = new TarArchiveEntry(plugin); tae.setName(plugin.getName()); tae.setUserId(0); tae.setMode(0755); tos.putArchiveEntry(tae); IOUtils.copy(new FileInputStream(plugin), tos); tos.closeArchiveEntry(); } }