< prev index next >
src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileAttributeView.java
Print this page
rev 53038 : 8215472: (zipfs) Cleanups in implementation classes of jdk.zipfs and tests
*** 1,7 ****
/*
! * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 23,43 ****
* questions.
*/
package jdk.nio.zipfs;
- import java.nio.file.attribute.*;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
! /*
! * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
*/
!
! class ZipFileAttributeView implements BasicFileAttributeView
! {
private static enum AttrID {
size,
creationTime,
lastAccessTime,
lastModifiedTime,
--- 23,43 ----
* questions.
*/
package jdk.nio.zipfs;
import java.io.IOException;
+ import java.nio.file.attribute.BasicFileAttributeView;
+ import java.nio.file.attribute.FileAttributeView;
+ import java.nio.file.attribute.FileTime;
import java.util.LinkedHashMap;
import java.util.Map;
! /**
! * @author Xueming Shen, Rajendra Gutupalli, Jaya Hangal
*/
! class ZipFileAttributeView implements BasicFileAttributeView {
private static enum AttrID {
size,
creationTime,
lastAccessTime,
lastModifiedTime,
*** 83,94 ****
@Override
public String name() {
return isZipView ? "zip" : "basic";
}
! public ZipFileAttributes readAttributes() throws IOException
! {
return path.getAttributes();
}
@Override
public void setTimes(FileTime lastModifiedTime,
--- 83,93 ----
@Override
public String name() {
return isZipView ? "zip" : "basic";
}
! public ZipFileAttributes readAttributes() throws IOException {
return path.getAttributes();
}
@Override
public void setTimes(FileTime lastModifiedTime,
*** 102,116 ****
void setAttribute(String attribute, Object value)
throws IOException
{
try {
if (AttrID.valueOf(attribute) == AttrID.lastModifiedTime)
! setTimes ((FileTime)value, null, null);
if (AttrID.valueOf(attribute) == AttrID.lastAccessTime)
! setTimes (null, (FileTime)value, null);
if (AttrID.valueOf(attribute) == AttrID.creationTime)
! setTimes (null, null, (FileTime)value);
return;
} catch (IllegalArgumentException x) {}
throw new UnsupportedOperationException("'" + attribute +
"' is unknown or read-only attribute");
}
--- 101,115 ----
void setAttribute(String attribute, Object value)
throws IOException
{
try {
if (AttrID.valueOf(attribute) == AttrID.lastModifiedTime)
! setTimes((FileTime)value, null, null);
if (AttrID.valueOf(attribute) == AttrID.lastAccessTime)
! setTimes(null, (FileTime)value, null);
if (AttrID.valueOf(attribute) == AttrID.creationTime)
! setTimes(null, null, (FileTime)value);
return;
} catch (IllegalArgumentException x) {}
throw new UnsupportedOperationException("'" + attribute +
"' is unknown or read-only attribute");
}
< prev index next >