打tar包工具TarUtil(8)

本文介绍了一种方法来检查给定文件列表相对于存档文件的更新状态。通过使用SourceFileScanner类和MergingMapper类,可以确定存档是否是最新的。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/**
     * Is the archive up to date in relationship to a list of files.
     * @param files the files to check
     * @param dir   the base directory for the files.
     * @return true if the archive is up to date.
     * @since Ant 1.5.2
     */
    protected boolean archiveIsUpToDate(String[] files, File dir)
    {
        SourceFileScanner sfs = new SourceFileScanner(this);
        MergingMapper mm = new MergingMapper();
        mm.setTo(tarFileObj.getAbsolutePath());
        return sfs.restrict(files, dir, null, mm).length == 0;
    }
   
    /**
     * This is a FileSet with the option to specify permissions
     * and other attributes.
     */
    public static class TarFileSet extends FileSet
    {
        private String[] files = null;
       
        private int fileMode = UnixStat.FILE_FLAG | UnixStat.DEFAULT_FILE_PERM;
       
        private int dirMode = UnixStat.DIR_FLAG | UnixStat.DEFAULT_DIR_PERM;
       
        private String userName = "";
       
        private String groupName = "";
       
        private int uid;
       
        private int gid;
       
        private String prefix = "";
       
        private String fullpath = "";
       
        private boolean preserveLeadingSlashes = false;
       
        /**
         * Creates a new <code>TarFileSet</code> instance.
         * Using a fileset as a constructor argument.
         *
         * @param fileset a <code>FileSet</code> value
         */
        public TarFileSet(FileSet fileset)
        {
            super(fileset);
        }
       
        /**
         * Creates a new <code>TarFileSet</code> instance.
         *
         */
        public TarFileSet()
        {
            super();
        }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值