src/java.base/share/classes/java/io/FileSystem.java
author jboes
Tue, 24 Sep 2019 09:43:43 +0100
changeset 58288 48e480e56aad
parent 51517 edcf0d527658
permissions -rw-r--r--
8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base Summary: Minor coding style update of javadoc tag in any file in java.base Reviewed-by: bchristi, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
58288
48e480e56aad 8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents: 51517
diff changeset
     2
 * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.io;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
15136
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
    28
import java.lang.annotation.Native;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * Package-private abstract class for the local filesystem abstraction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
abstract class FileSystem {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    /* -- Normalization and construction -- */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
     * Return the local filesystem's name-separator character.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
    public abstract char getSeparator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
     * Return the local filesystem's path-separator character.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    public abstract char getPathSeparator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
     * Convert the given pathname string to normal form.  If the string is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * already in normal form then it is simply returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    public abstract String normalize(String path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * Compute the length of this pathname string's prefix.  The pathname
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * string must be in normal form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    public abstract int prefixLength(String path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * Resolve the child pathname string against the parent.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * Both strings must be in normal form, and the result
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * will be in normal form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    public abstract String resolve(String parent, String child);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * Return the parent pathname string to be used when the parent-directory
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * argument in one of the two-argument File constructors is the empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * pathname.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public abstract String getDefaultParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * Post-process the given URI path string if necessary.  This is used on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * win32, e.g., to transform "/c:/foo" into "c:/foo".  The path string
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * still has slash separators; code in the File class will translate them
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * after this method returns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    public abstract String fromURIPath(String path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    /* -- Path operations -- */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * Tell whether or not the given abstract pathname is absolute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public abstract boolean isAbsolute(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * Resolve the given abstract pathname into absolute form.  Invoked by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * getAbsolutePath and getCanonicalPath methods in the File class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    public abstract String resolve(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    public abstract String canonicalize(String path) throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    /* -- Attribute accessors -- */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /* Constants for simple boolean attributes */
15136
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   102
    @Native public static final int BA_EXISTS    = 0x01;
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   103
    @Native public static final int BA_REGULAR   = 0x02;
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   104
    @Native public static final int BA_DIRECTORY = 0x04;
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   105
    @Native public static final int BA_HIDDEN    = 0x08;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Return the simple boolean attributes for the file or directory denoted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * by the given abstract pathname, or zero if it does not exist or some
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * other I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    public abstract int getBooleanAttributes(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
15136
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   114
    @Native public static final int ACCESS_READ    = 0x04;
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   115
    @Native public static final int ACCESS_WRITE   = 0x02;
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   116
    @Native public static final int ACCESS_EXECUTE = 0x01;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * Check whether the file or directory denoted by the given abstract
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * pathname may be accessed by this process.  The second argument specifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * which access, ACCESS_READ, ACCESS_WRITE or ACCESS_EXECUTE, to check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * Return false if access is denied or an I/O error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    public abstract boolean checkAccess(File f, int access);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * Set on or off the access permission (to owner only or to all) to the file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * or directory denoted by the given abstract pathname, based on the parameters
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * enable, access and oweronly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    public abstract boolean setPermission(File f, int access, boolean enable, boolean owneronly);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * Return the time at which the file or directory denoted by the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * abstract pathname was last modified, or zero if it does not exist or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * some other I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    public abstract long getLastModifiedTime(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * Return the length in bytes of the file denoted by the given abstract
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * pathname, or zero if it does not exist, is a directory, or some other
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    public abstract long getLength(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    /* -- File operations -- */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * Create a new empty file with the given pathname.  Return
58288
48e480e56aad 8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents: 51517
diff changeset
   151
     * {@code true} if the file was created and {@code false} if a
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * file or directory with the given pathname already exists.  Throw an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * IOException if an I/O error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    public abstract boolean createFileExclusively(String pathname)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        throws IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * Delete the file or directory denoted by the given abstract pathname,
58288
48e480e56aad 8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents: 51517
diff changeset
   160
     * returning {@code true} if and only if the operation succeeds.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    public abstract boolean delete(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * List the elements of the directory denoted by the given abstract
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * pathname.  Return an array of strings naming the elements of the
58288
48e480e56aad 8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents: 51517
diff changeset
   167
     * directory if successful; otherwise, return {@code null}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    public abstract String[] list(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Create a new directory denoted by the given abstract pathname,
58288
48e480e56aad 8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents: 51517
diff changeset
   173
     * returning {@code true} if and only if the operation succeeds.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    public abstract boolean createDirectory(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * Rename the file or directory denoted by the first abstract pathname to
58288
48e480e56aad 8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents: 51517
diff changeset
   179
     * the second abstract pathname, returning {@code true} if and only if
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * the operation succeeds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    public abstract boolean rename(File f1, File f2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * Set the last-modified time of the file or directory denoted by the
58288
48e480e56aad 8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents: 51517
diff changeset
   186
     * given abstract pathname, returning {@code true} if and only if the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * operation succeeds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    public abstract boolean setLastModifiedTime(File f, long time);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * Mark the file or directory denoted by the given abstract pathname as
58288
48e480e56aad 8231186: Replace html tag <code>foo</code> with javadoc tag {@code foo} in java.base
jboes
parents: 51517
diff changeset
   193
     * read-only, returning {@code true} if and only if the operation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * succeeds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    public abstract boolean setReadOnly(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    /* -- Filesystem interface -- */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * List the available filesystem roots.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    public abstract File[] listRoots();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    /* -- Disk usage -- */
15136
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   207
    @Native public static final int SPACE_TOTAL  = 0;
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   208
    @Native public static final int SPACE_FREE   = 1;
c17824042364 8005856: build-infra: Remove special handling of base module classes header generation
erikj
parents: 14324
diff changeset
   209
    @Native public static final int SPACE_USABLE = 2;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    public abstract long getSpace(File f, int t);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    /* -- Basic infrastructure -- */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /**
42777
a94fc33e9866 8148023: File.createTempFile is not adhering to the contract regarding file name lengths
bpb
parents: 40410
diff changeset
   216
     * Retrieve the maximum length of a component of a file path.
a94fc33e9866 8148023: File.createTempFile is not adhering to the contract regarding file name lengths
bpb
parents: 40410
diff changeset
   217
     *
a94fc33e9866 8148023: File.createTempFile is not adhering to the contract regarding file name lengths
bpb
parents: 40410
diff changeset
   218
     * @return The maximum length of a file path component.
a94fc33e9866 8148023: File.createTempFile is not adhering to the contract regarding file name lengths
bpb
parents: 40410
diff changeset
   219
     */
a94fc33e9866 8148023: File.createTempFile is not adhering to the contract regarding file name lengths
bpb
parents: 40410
diff changeset
   220
    public abstract int getNameMax(String path);
a94fc33e9866 8148023: File.createTempFile is not adhering to the contract regarding file name lengths
bpb
parents: 40410
diff changeset
   221
a94fc33e9866 8148023: File.createTempFile is not adhering to the contract regarding file name lengths
bpb
parents: 40410
diff changeset
   222
    /**
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * Compare two abstract pathnames lexicographically.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    public abstract int compare(File f1, File f2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * Compute the hash code of an abstract pathname.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    public abstract int hashCode(File f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    // Flags for enabling/disabling performance optimizations for file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    // name canonicalization
51517
edcf0d527658 8209837: Avoid initializing ExpiringCache during bootstrap
redestad
parents: 51039
diff changeset
   234
    static final boolean useCanonCaches;
edcf0d527658 8209837: Avoid initializing ExpiringCache during bootstrap
redestad
parents: 51039
diff changeset
   235
    static final boolean useCanonPrefixCache;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    private static boolean getBooleanProperty(String prop, boolean defaultVal) {
51517
edcf0d527658 8209837: Avoid initializing ExpiringCache during bootstrap
redestad
parents: 51039
diff changeset
   238
        String value = System.getProperty(prop);
edcf0d527658 8209837: Avoid initializing ExpiringCache during bootstrap
redestad
parents: 51039
diff changeset
   239
        return (value != null) ? Boolean.parseBoolean(value) : defaultVal;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    static {
51517
edcf0d527658 8209837: Avoid initializing ExpiringCache during bootstrap
redestad
parents: 51039
diff changeset
   243
        useCanonCaches      = getBooleanProperty("sun.io.useCanonCaches", false);
edcf0d527658 8209837: Avoid initializing ExpiringCache during bootstrap
redestad
parents: 51039
diff changeset
   244
        useCanonPrefixCache = useCanonCaches && getBooleanProperty("sun.io.useCanonPrefixCache", false);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
}