我有一个从远程URL(使用Java)下载文件的功能.现在我想知道真正的修改日期,因为当我下载它时我丢失了这个信息.提前致谢.
public void downloadFile(String remoteFile, String localFile)
throws IOException {
BufferedInputStream in;
try {
URL url = new URL(remoteFile);
in = new BufferedInputStream(url.openStream());
FileOutputStream fos = new FileOutputStream(localFile);
BufferedOutputStream bout = new BufferedOutputStream(fos, 1024);
byte data[] = new byte[1024];
int count = 0;
while ((count = in.read(data, 0, 1024)) > 0) {
bout.write(data, 0, count);
}
bout.close();
in.close();
log.write(remoteFile + " - Download Successful.");
//System.out.println(remoteFile + " - Download Successful.");
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) …Run Code Online (Sandbox Code Playgroud) 我尝试在我的所有页面中运行基本的 javascript(在加载另一个 html 代码之前),然后将我的 js 函数添加到 _Layout.cshtml 但不起作用(我不知道如何是正确的方法)。提前致谢。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<meta name="viewport" content="width=device-width" />
<link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
@Styles.Render("~/Content/mobileCss", "~/Content/css")
@Scripts.Render("~/bundles/modernizr")
<script type="text/javascript">
$(document).ready(function () {
alert("Do something");
});
</script>
</head>
<body>
<div data-role="page" data-theme="b">
<div data-role="content">
@RenderBody()
</div>
</div>
@Scripts.Render("~/bundles/jquery", "~/bundles/jquerymobile")
@RenderSection("scripts", required: false)
</body>
</html>
Run Code Online (Sandbox Code Playgroud)