< prev index next >

src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributes.java

Print this page

  1 /*
  2  * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.  Oracle designates this
  8  * particular file as subject to the "Classpath" exception as provided
  9  * by Oracle in the LICENSE file that accompanied this code.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any

 32 /**
 33  * File attributes implementation for jrt image file system.
 34  *
 35  * @implNote This class needs to maintain JDK 8 source compatibility.
 36  *
 37  * It is used internally in the JDK to implement jimage/jrtfs access,
 38  * but also compiled and delivered as part of the jrtfs.jar to support access
 39  * to the jimage file provided by the shipped JDK by tools running on JDK 8.
 40  */
 41 final class JrtFileAttributes  implements BasicFileAttributes {
 42 
 43     private final Node node;
 44 
 45     JrtFileAttributes(Node node) {
 46         this.node = node;
 47     }
 48 
 49     //-------- basic attributes --------
 50     @Override
 51     public FileTime creationTime() {
 52         return node.creationTime();
 53     }
 54 
 55     @Override
 56     public boolean isDirectory() {
 57         return node.isDirectory();
 58     }
 59 
 60     @Override
 61     public boolean isOther() {
 62         return false;
 63     }
 64 
 65     @Override
 66     public boolean isRegularFile() {
 67         return !isDirectory();
 68     }
 69 
 70     @Override
 71     public FileTime lastAccessTime() {
 72         return node.lastAccessTime();
 73     }
 74 
 75     @Override
 76     public FileTime lastModifiedTime() {
 77         return node.lastModifiedTime();
 78     }
 79 
 80     @Override
 81     public long size() {
 82         return node.size();
 83     }
 84 
 85     @Override
 86     public boolean isSymbolicLink() {
 87         return node.isLink();
 88     }
 89 
 90     @Override
 91     public Object fileKey() {
 92         return node.resolveLink(true);
 93     }
 94 
 95     //-------- jrtfs specific attributes --------
 96     /**
 97      * Compressed resource file. If not available or not applicable, 0L is

  1 /*
  2  * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.  Oracle designates this
  8  * particular file as subject to the "Classpath" exception as provided
  9  * by Oracle in the LICENSE file that accompanied this code.
 10  *
 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any

 32 /**
 33  * File attributes implementation for jrt image file system.
 34  *
 35  * @implNote This class needs to maintain JDK 8 source compatibility.
 36  *
 37  * It is used internally in the JDK to implement jimage/jrtfs access,
 38  * but also compiled and delivered as part of the jrtfs.jar to support access
 39  * to the jimage file provided by the shipped JDK by tools running on JDK 8.
 40  */
 41 final class JrtFileAttributes  implements BasicFileAttributes {
 42 
 43     private final Node node;
 44 
 45     JrtFileAttributes(Node node) {
 46         this.node = node;
 47     }
 48 
 49     //-------- basic attributes --------
 50     @Override
 51     public FileTime creationTime() {
 52         return node.getFileAttributes().creationTime();
 53     }
 54 
 55     @Override
 56     public boolean isDirectory() {
 57         return node.isDirectory();
 58     }
 59 
 60     @Override
 61     public boolean isOther() {
 62         return false;
 63     }
 64 
 65     @Override
 66     public boolean isRegularFile() {
 67         return !isDirectory();
 68     }
 69 
 70     @Override
 71     public FileTime lastAccessTime() {
 72         return node.getFileAttributes().lastAccessTime();
 73     }
 74 
 75     @Override
 76     public FileTime lastModifiedTime() {
 77         return node.getFileAttributes().lastModifiedTime();
 78     }
 79 
 80     @Override
 81     public long size() {
 82         return node.size();
 83     }
 84 
 85     @Override
 86     public boolean isSymbolicLink() {
 87         return node.isLink();
 88     }
 89 
 90     @Override
 91     public Object fileKey() {
 92         return node.resolveLink(true);
 93     }
 94 
 95     //-------- jrtfs specific attributes --------
 96     /**
 97      * Compressed resource file. If not available or not applicable, 0L is
< prev index next >