/** * Set this entry's name. * * @param name This entry's new name. */ public void setName(String name) { this.name = normalizeFileName(name, false); }
/** * Construct an entry with only a name. This allows the programmer * to construct the entry's header "by hand". File is set to null. * * @param name the entry name * @param preserveLeadingSlashes whether to allow leading slashes * in the name. */ public TarEntry(String name, boolean preserveLeadingSlashes) { this(); name = normalizeFileName(name, preserveLeadingSlashes); boolean isDir = name.endsWith("/"); this.devMajor = 0; this.devMinor = 0; this.name = name; this.mode = isDir ? DEFAULT_DIR_MODE : DEFAULT_FILE_MODE; this.linkFlag = isDir ? LF_DIR : LF_NORMAL; this.userId = 0; this.groupId = 0; this.size = 0; this.modTime = (new Date()).getTime() / MILLIS_PER_SECOND; this.linkName = ""; this.userName = ""; this.groupName = ""; }
this(); String normalizedName = normalizeFileName(fileName, false); this.file = file;