本文整理了Java中java.util.zip.ZipEntry.getLastModifiedTime()
方法的一些代码示例,展示了ZipEntry.getLastModifiedTime()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipEntry.getLastModifiedTime()
方法的具体详情如下:
包路径:java.util.zip.ZipEntry
类名称:ZipEntry
方法名:getLastModifiedTime
暂无
代码示例来源:origin: zeroturnaround/zt-zip
public void setTime(ZipEntry newInstance, ZipEntry oldInstance) {
{
FileTime time = oldInstance.getCreationTime();
if (time != null) {
newInstance.setCreationTime(time);
}
}
{
FileTime time = oldInstance.getLastModifiedTime();
if (time != null) {
newInstance.setLastModifiedTime(time);
}
}
{
FileTime time = oldInstance.getLastAccessTime();
if (time != null) {
newInstance.setLastAccessTime(time);
}
}
}
代码示例来源:origin: stackoverflow.com
// The ClassLoader returns a directory listing in some cases.
// As this listing is partial, it is of little value in the context
// of the CLAP client, so we have to ignore them.
if (url != null) {
if (url.getProtocol().equals("file")) {
File file = new File(url.getFile());
modificationDate = new Date(file.lastModified());
if (file.isDirectory()) {
url = null;
}
//NEW CODE HERE
} else if (url.getProtocol().equals("jar")) {
try {
JarURLConnection conn = (JarURLConnection) url.openConnection();
modificationDate = new Date(conn.getJarEntry().getLastModifiedTime().toMillis());
if (conn.getJarEntry().isDirectory()) {
url = null;
}
} catch (IOException ioe) {
getLogger().log(Level.WARNING,
"Unable to open the representation's input stream",
ioe);
response.setStatus(Status.SERVER_ERROR_INTERNAL);
}
}
}
代码示例来源:origin: wildfly/wildfly-core
private static void unzip(final ZipFile zip, final Path targetDir) throws IOException {
final Enumeration<? extends ZipEntry> entries = zip.entries();
while (entries.hasMoreElements()) {
final ZipEntry entry = entries.nextElement();
final String name = entry.getName();
final Path current = resolveSecurely(targetDir, name);
if (entry.isDirectory()) {
if (!Files.exists(current)) {
Files.createDirectories(current);
}
} else {
if (Files.notExists(current.getParent())) {
Files.createDirectories(current.getParent());
}
try (final InputStream eis = zip.getInputStream(entry)) {
Files.copy(eis, current);
}
}
try {
Files.getFileAttributeView(current, BasicFileAttributeView.class).setTimes(entry.getLastModifiedTime(), entry.getLastAccessTime(), entry.getCreationTime());
} catch (IOException e) {
//ignore, if we cannot set it, world will not end
}
}
}
代码示例来源:origin: docbleach/DocBleach
private ZipEntry cloneEntry(ZipEntry entry) {
ZipEntry newEntry = new ZipEntry(entry.getName());
newEntry.setTime(entry.getTime());
if (entry.getCreationTime() != null) {
newEntry.setCreationTime(entry.getCreationTime());
}
if (entry.getLastModifiedTime() != null) {
newEntry.setLastModifiedTime(entry.getLastModifiedTime());
}
if (entry.getLastAccessTime() != null) {
newEntry.setLastAccessTime(entry.getLastAccessTime());
}
newEntry.setComment(entry.getComment());
newEntry.setExtra(entry.getExtra());
return newEntry;
}
}
代码示例来源:origin: org.sakaiproject.portal/sakai-portal-impl
try {
ZipEntry zipEntry = ((JarURLConnection)url.openConnection()).getJarEntry();
lastModified = zipEntry.getLastModifiedTime().toMillis();
length = zipEntry.getSize();
} catch (ClassCastException cce) {
代码示例来源:origin: sakaiproject/sakai
try {
ZipEntry zipEntry = ((JarURLConnection)url.openConnection()).getJarEntry();
lastModified = zipEntry.getLastModifiedTime().toMillis();
length = zipEntry.getSize();
} catch (ClassCastException cce) {
代码示例来源:origin: de.richtercloud/jhbuild-java-wrapper-core
entry.getLastModifiedTime());
LOGGER.trace(String.format("last modified time of file or directory '%s' is %s",
filePath,
代码示例来源:origin: org.zeroturnaround/zt-zip
public void setTime(ZipEntry newInstance, ZipEntry oldInstance) {
{
FileTime time = oldInstance.getCreationTime();
if (time != null) {
newInstance.setCreationTime(time);
}
}
{
FileTime time = oldInstance.getLastModifiedTime();
if (time != null) {
newInstance.setLastModifiedTime(time);
}
}
{
FileTime time = oldInstance.getLastAccessTime();
if (time != null) {
newInstance.setLastAccessTime(time);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!