⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tarentry.java

📁 Use the links below to download a source distribution of Ant from one of our mirrors. It is good pra
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     *     * @return This entry's name.     */    public String getName() {        return this.name.toString();    }    /**     * Set this entry's name.     *     * @param name This entry's new name.     */    public void setName(String name) {        this.name = new StringBuffer(name);    }    /**     * Set the mode for this entry     *     * @param mode the mode for this entry     */    public void setMode(int mode) {        this.mode = mode;    }    /**     * Get this entry's link name.     *     * @return This entry's link name.     */    public String getLinkName() {        return this.linkName.toString();    }    /**     * Get this entry's user id.     *     * @return This entry's user id.     */    public int getUserId() {        return this.userId;    }    /**     * Set this entry's user id.     *     * @param userId This entry's new user id.     */    public void setUserId(int userId) {        this.userId = userId;    }    /**     * Get this entry's group id.     *     * @return This entry's group id.     */    public int getGroupId() {        return this.groupId;    }    /**     * Set this entry's group id.     *     * @param groupId This entry's new group id.     */    public void setGroupId(int groupId) {        this.groupId = groupId;    }    /**     * Get this entry's user name.     *     * @return This entry's user name.     */    public String getUserName() {        return this.userName.toString();    }    /**     * Set this entry's user name.     *     * @param userName This entry's new user name.     */    public void setUserName(String userName) {        this.userName = new StringBuffer(userName);    }    /**     * Get this entry's group name.     *     * @return This entry's group name.     */    public String getGroupName() {        return this.groupName.toString();    }    /**     * Set this entry's group name.     *     * @param groupName This entry's new group name.     */    public void setGroupName(String groupName) {        this.groupName = new StringBuffer(groupName);    }    /**     * Convenience method to set this entry's group and user ids.     *     * @param userId This entry's new user id.     * @param groupId This entry's new group id.     */    public void setIds(int userId, int groupId) {        this.setUserId(userId);        this.setGroupId(groupId);    }    /**     * Convenience method to set this entry's group and user names.     *     * @param userName This entry's new user name.     * @param groupName This entry's new group name.     */    public void setNames(String userName, String groupName) {        this.setUserName(userName);        this.setGroupName(groupName);    }    /**     * Set this entry's modification time. The parameter passed     * to this method is in "Java time".     *     * @param time This entry's new modification time.     */    public void setModTime(long time) {        this.modTime = time / MILLIS_PER_SECOND;    }    /**     * Set this entry's modification time.     *     * @param time This entry's new modification time.     */    public void setModTime(Date time) {        this.modTime = time.getTime() / MILLIS_PER_SECOND;    }    /**     * Set this entry's modification time.     *     * @return time This entry's new modification time.     */    public Date getModTime() {        return new Date(this.modTime * MILLIS_PER_SECOND);    }    /**     * Get this entry's file.     *     * @return This entry's file.     */    public File getFile() {        return this.file;    }    /**     * Get this entry's mode.     *     * @return This entry's mode.     */    public int getMode() {        return this.mode;    }    /**     * Get this entry's file size.     *     * @return This entry's file size.     */    public long getSize() {        return this.size;    }    /**     * Set this entry's file size.     *     * @param size This entry's new file size.     */    public void setSize(long size) {        this.size = size;    }    /**     * Indicate if this entry is a GNU long name block     *     * @return true if this is a long name extension provided by GNU tar     */    public boolean isGNULongNameEntry() {        return linkFlag == LF_GNUTYPE_LONGNAME                           && name.toString().equals(GNU_LONGLINK);    }    /**     * Return whether or not this entry represents a directory.     *     * @return True if this entry is a directory.     */    public boolean isDirectory() {        if (this.file != null) {            return this.file.isDirectory();        }        if (this.linkFlag == LF_DIR) {            return true;        }        if (this.getName().endsWith("/")) {            return true;        }        return false;    }    /**     * If this entry represents a file, and the file is a directory, return     * an array of TarEntries for this entry's children.     *     * @return An array of TarEntry's for this entry's children.     */    public TarEntry[] getDirectoryEntries() {        if (this.file == null || !this.file.isDirectory()) {            return new TarEntry[0];        }        String[]   list = this.file.list();        TarEntry[] result = new TarEntry[list.length];        for (int i = 0; i < list.length; ++i) {            result[i] = new TarEntry(new File(this.file, list[i]));        }        return result;    }    /**     * Write an entry's header information to a header buffer.     *     * @param outbuf The tar entry header buffer to fill in.     */    public void writeEntryHeader(byte[] outbuf) {        int offset = 0;        offset = TarUtils.getNameBytes(this.name, outbuf, offset, NAMELEN);        offset = TarUtils.getOctalBytes(this.mode, outbuf, offset, MODELEN);        offset = TarUtils.getOctalBytes(this.userId, outbuf, offset, UIDLEN);        offset = TarUtils.getOctalBytes(this.groupId, outbuf, offset, GIDLEN);        offset = TarUtils.getLongOctalBytes(this.size, outbuf, offset, SIZELEN);        offset = TarUtils.getLongOctalBytes(this.modTime, outbuf, offset, MODTIMELEN);        int csOffset = offset;        for (int c = 0; c < CHKSUMLEN; ++c) {            outbuf[offset++] = (byte) ' ';        }        outbuf[offset++] = this.linkFlag;        offset = TarUtils.getNameBytes(this.linkName, outbuf, offset, NAMELEN);        offset = TarUtils.getNameBytes(this.magic, outbuf, offset, MAGICLEN);        offset = TarUtils.getNameBytes(this.userName, outbuf, offset, UNAMELEN);        offset = TarUtils.getNameBytes(this.groupName, outbuf, offset, GNAMELEN);        offset = TarUtils.getOctalBytes(this.devMajor, outbuf, offset, DEVLEN);        offset = TarUtils.getOctalBytes(this.devMinor, outbuf, offset, DEVLEN);        while (offset < outbuf.length) {            outbuf[offset++] = 0;        }        long chk = TarUtils.computeCheckSum(outbuf);        TarUtils.getCheckSumOctalBytes(chk, outbuf, csOffset, CHKSUMLEN);    }    /**     * Parse an entry's header information from a header buffer.     *     * @param header The tar entry header buffer to get information from.     */    public void parseTarHeader(byte[] header) {        int offset = 0;        this.name = TarUtils.parseName(header, offset, NAMELEN);        offset += NAMELEN;        this.mode = (int) TarUtils.parseOctal(header, offset, MODELEN);        offset += MODELEN;        this.userId = (int) TarUtils.parseOctal(header, offset, UIDLEN);        offset += UIDLEN;        this.groupId = (int) TarUtils.parseOctal(header, offset, GIDLEN);        offset += GIDLEN;        this.size = TarUtils.parseOctal(header, offset, SIZELEN);        offset += SIZELEN;        this.modTime = TarUtils.parseOctal(header, offset, MODTIMELEN);        offset += MODTIMELEN;        offset += CHKSUMLEN;        this.linkFlag = header[offset++];        this.linkName = TarUtils.parseName(header, offset, NAMELEN);        offset += NAMELEN;        this.magic = TarUtils.parseName(header, offset, MAGICLEN);        offset += MAGICLEN;        this.userName = TarUtils.parseName(header, offset, UNAMELEN);        offset += UNAMELEN;        this.groupName = TarUtils.parseName(header, offset, GNAMELEN);        offset += GNAMELEN;        this.devMajor = (int) TarUtils.parseOctal(header, offset, DEVLEN);        offset += DEVLEN;        this.devMinor = (int) TarUtils.parseOctal(header, offset, DEVLEN);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -