org.apache.tools.ant.util.FileUtils.setFileLastModified()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(104)

本文整理了Java中org.apache.tools.ant.util.FileUtils.setFileLastModified()方法的一些代码示例,展示了FileUtils.setFileLastModified()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.setFileLastModified()方法的具体详情如下:
包路径:org.apache.tools.ant.util.FileUtils
类名称:FileUtils
方法名:setFileLastModified

FileUtils.setFileLastModified介绍

[英]Calls File.setLastModified(long time). Originally written to to dynamically bind to that call on Java1.2+.
[中]调用文件。setLastModified(长时间)。最初编写为动态绑定到Java1上的调用。2+.

代码示例

代码示例来源:origin: org.apache.ant/ant

private void updateTimeStamp() {
  final long remoteTimestamp = connection.getLastModified();
  if (verbose)  {
    final Date t = new Date(remoteTimestamp);
    log("last modified = " + t.toString()
      + ((remoteTimestamp == 0) ? " - using current time instead" : ""), logLevel);
  }
  if (remoteTimestamp != 0) {
    FILE_UTILS.setFileLastModified(dest, remoteTimestamp);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Call File.setLastModified(long time) on Java above 1.1, and logs
 * a warning on Java 1.1.
 *
 * @param file The file to set the last modified time on.
 *             Must not be <code>null</code>.
 *
 * @param time the required modification time.
 *
 * @deprecated since 1.4.x
 *
 * @exception BuildException if the last modified time cannot be set
 *                           despite running on a platform with a version
 *                           above 1.1.
 */
@Deprecated
public void setFileLastModified(final File file, final long time)
   throws BuildException {
  FILE_UTILS.setFileLastModified(file, time);
  log("Setting modification time for " + file, MSG_VERBOSE);
}

代码示例来源:origin: org.apache.ant/ant

private void touch(File file, long modTime) {
  if (!file.exists()) {
    log("Creating " + file,
      ((verbose) ? Project.MSG_INFO : Project.MSG_VERBOSE));
    try {
      FILE_UTILS.createNewFile(file, mkdirs);
    } catch (IOException ioe) {
      throw new BuildException("Could not create " + file, ioe,
                   getLocation());
    }
  }
  if (!file.canWrite()) {
    throw new BuildException(
      "Can not change modification date of read-only file %s", file);
  }
  FILE_UTILS.setFileLastModified(file, modTime);
}

代码示例来源:origin: org.apache.ant/ant

FILE_UTILS.rename(temp, f);
if (preserveLastModified) {
  FILE_UTILS.setFileLastModified(f, origLastModified);

代码示例来源:origin: org.apache.ant/ant

fileUtils.setFileLastModified(f, entryDate.getTime());
} catch (FileNotFoundException ex) {
  log("Unable to expand to file " + f.getPath(),

代码示例来源:origin: org.apache.ant/ant

log("preserved lastModified for " + destFile,
  Project.MSG_DEBUG);
FILE_UTILS.setFileLastModified(destFile, lastModified);

代码示例来源:origin: org.apache.ant/ant

FILE_UTILS.rename(temp, src);
if (preserveLastModified) {
  FILE_UTILS.setFileLastModified(src, origLastModified);

代码示例来源:origin: org.apache.ant/ant

FILE_UTILS.setFileLastModified(targetFile, lastModified);

代码示例来源:origin: maven/maven

fileUtils.setFileLastModified( f, entryDate.getTime() );

代码示例来源:origin: org.apache.ant/ant-jsch

FileUtils.getFileUtils().setFileLastModified(localFile,
    ((long) le.getAttrs().getMTime()) * 1000);

代码示例来源:origin: org.apache.ant/ant-jsch

private void setLastModified(final File localFile) throws JSchException {
  SftpATTRS fileAttributes = null;
  final ChannelSftp channel = openSftpChannel();
  channel.connect();
  try {
    fileAttributes = channel.lstat(remoteDir(remoteFile)
                    + localFile.getName());
  } catch (final SftpException e) {
    throw new JSchException("failed to stat remote file", e);
  }
  FileUtils.getFileUtils().setFileLastModified(localFile,
      ((long) fileAttributes.getMTime()) * 1000);
}

代码示例来源:origin: org.apache.ant/ant-commons-net

FTPFile[] remote = ftp.listFiles(resolveFile(filename));
if (remote.length > 0) {
  FILE_UTILS.setFileLastModified(file,
                  remote[0].getTimestamp()
                  .getTime().getTime());

代码示例来源:origin: com.github.goldin/maven-common

FTPFile[] remote = ftp.listFiles(resolveFile(filename));
if (remote.length > 0) {
  FILE_UTILS.setFileLastModified(file,
                  remote[0].getTimestamp()
                  .getTime().getTime());

代码示例来源:origin: de.unkrig/antology

FTPFile[] remote = ftp.listFiles(resolveFile(filename));
if (remote.length > 0) {
  FILE_UTILS.setFileLastModified(file,
                  remote[0].getTimestamp()
                  .getTime().getTime());

代码示例来源:origin: org.apache.ant/ant-commons-net

FTPFile[] remote = ftp.listFiles(resolveFile(filename));
if (remote.length > 0) {
  FILE_UTILS.setFileLastModified(file,
                  remote[0].getTimestamp()
                  .getTime().getTime());

相关文章