org.apache.tools.ant.taskdefs.Get.setUseTimestamp()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(105)

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

Get.setUseTimestamp介绍

[英]If true, conditionally download a file based on the timestamp of the local copy.

In this situation, the if-modified-since header is set so that the file is only fetched if it is newer than the local file (or there is no local file) This flag is only valid on HTTP connections, it is ignored in other cases. When the flag is set, the local copy of the downloaded file will also have its timestamp set to the remote file time.

Note that remote files of date 1/1/1970 (GMT) are treated as 'no timestamp', and web servers often serve files with a timestamp in the future by replacing their timestamp with that of the current time. Also, inter-computer clock differences can cause no end of grief.
[中]如果为true,则根据本地副本的时间戳有条件地下载文件。
在这种情况下,将设置if-modified-since头,以便仅当文件比本地文件(或没有本地文件)新时才获取该文件。此标志仅在HTTP连接上有效,在其他情况下将忽略它。设置该标志后,下载文件的本地副本的时间戳也将设置为远程文件时间。
请注意,日期为1970年1月1日(GMT)的远程文件被视为“无时间戳”,web服务器通常在将来通过将其时间戳替换为当前时间戳来为具有时间戳的文件提供服务。此外,计算机间的时钟差异可能会导致无尽的悲痛。

代码示例

代码示例来源:origin: org.dspace/dspace-stats

get.setDest(new File(spiders, url.getHost() + url.getPath().replace("/","-")));
get.setSrc(url);
get.setUseTimestamp(true);
get.execute();

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

get.setDest(new File(spiders, url.getHost() + url.getPath().replace("/", "-")));
get.setSrc(url);
get.setUseTimestamp(true);
get.execute();

代码示例来源:origin: codehaus-cargo/cargo

getTask.setUseTimestamp(true);
getTask.setSrc(this.remoteLocation);
String userInfo = this.remoteLocation.getUserInfo();

代码示例来源:origin: net.wasdev.wlp.ant/wlp-anttasks

private void onlineDownload(URL source, File dest) throws IOException {
  Get get = (Get) getProject().createTask("get");
  DownloadProgress progress = null;
  if (verbose) {
    progress = new Get.VerboseProgress(System.out);
  }
  get.setUseTimestamp(true);
  get.setUsername(username);
  get.setPassword(password);
  get.setMaxTime(maxDownloadTime);
  get.doGet(source, dest, Project.MSG_INFO, progress);
}

相关文章

微信公众号

最新文章

更多