diff options
Diffstat (limited to 'libjava/java/io/File.java')
-rw-r--r-- | libjava/java/io/File.java | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java index b4951ec..53ae529 100644 --- a/libjava/java/io/File.java +++ b/libjava/java/io/File.java @@ -1,5 +1,6 @@ /* File.java -- Class representing a file on disk - Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -121,7 +122,7 @@ public class File implements Serializable, Comparable { if (Configuration.INIT_LOAD_LIBRARY) { - System.loadLibrary ("javaio"); + System.loadLibrary("javaio"); } init_native(); @@ -187,7 +188,7 @@ public class File implements Serializable, Comparable * the path of this <code>File</code> object if an only if that file * does not already exist. * <p> - * A <code>SecurityManager</code>checkWrite</code> check is done prior + * A <code>SecurityManager.checkWrite</code> check is done prior * to performing this action. * * @return <code>true</code> if the file was created, <code>false</code> if @@ -224,7 +225,7 @@ public class File implements Serializable, Comparable SecurityManager s = System.getSecurityManager(); if (s != null) - s.checkDelete (path); + s.checkDelete(path); return performDelete(); } @@ -244,7 +245,7 @@ public class File implements Serializable, Comparable * @return <code>true</code> if the two objects are equal, * <code>false</code> otherwise. */ - public boolean equals (Object obj) + public boolean equals(Object obj) { if (! (obj instanceof File)) return false; @@ -252,9 +253,9 @@ public class File implements Serializable, Comparable File other = (File) obj; if (caseSensitive) - return path.equals (other.path); + return path.equals(other.path); else - return path.equalsIgnoreCase (other.path); + return path.equalsIgnoreCase(other.path); } /** @@ -277,7 +278,7 @@ public class File implements Serializable, Comparable * * @param name The path name of the file */ - public File (String name) + public File(String name) { path = normalizePath (name); } @@ -354,7 +355,7 @@ public class File implements Serializable, Comparable * @param dirPath The path to the directory the file resides in * @param name The name of the file */ - public File (String dirPath, String name) + public File(String dirPath, String name) { if (name == null) throw new NullPointerException(); @@ -381,7 +382,7 @@ public class File implements Serializable, Comparable * @param directory The directory this file resides in * @param name The name of the file */ - public File (File directory, String name) + public File(File directory, String name) { this (directory == null ? null : directory.path, name); } @@ -448,7 +449,7 @@ public class File implements Serializable, Comparable */ public File getAbsoluteFile() { - return new File (getAbsolutePath()); + return new File(getAbsolutePath()); } /** @@ -479,7 +480,7 @@ public class File implements Serializable, Comparable */ public File getCanonicalFile() throws IOException { - return new File (getCanonicalPath()); + return new File(getCanonicalPath()); } /** @@ -591,7 +592,7 @@ public class File implements Serializable, Comparable public File getParentFile() { String parent = getParent(); - return parent != null ? new File (parent) : null; + return parent != null ? new File(parent) : null; } /** @@ -748,7 +749,7 @@ public class File implements Serializable, Comparable * @exception SecurityException If read access is not allowed to the * directory by the <code>SecurityManager</code> */ - public String[] list (FilenameFilter filter) + public String[] list(FilenameFilter filter) { checkRead(); return (String[]) performList (filter, null, String.class); @@ -826,7 +827,7 @@ public class File implements Serializable, Comparable * * @since 1.2 */ - public File[] listFiles (FilenameFilter filter) + public File[] listFiles(FilenameFilter filter) { checkRead(); return (File[]) performList (filter, null, File.class); @@ -856,7 +857,7 @@ public class File implements Serializable, Comparable * * @since 1.2 */ - public File[] listFiles (FileFilter filter) + public File[] listFiles(FileFilter filter) { checkRead(); return (File[]) performList (null, filter, File.class); @@ -982,8 +983,8 @@ public class File implements Serializable, Comparable * * @since 1.2 */ - public static File createTempFile (String prefix, String suffix, - File directory) + public static File createTempFile(String prefix, String suffix, + File directory) throws IOException { // Grab the system temp directory if necessary @@ -1005,7 +1006,7 @@ public class File implements Serializable, Comparable // Check if prefix is at least 3 characters long if (prefix.length() < 3) - throw new IllegalArgumentException ("Prefix too short: " + prefix); + throw new IllegalArgumentException("Prefix too short: " + prefix); // Set default value of suffix if (suffix == null) @@ -1146,10 +1147,10 @@ public class File implements Serializable, Comparable * this operation * @exception IOException If an error occurs */ - public static File createTempFile (String prefix, String suffix) + public static File createTempFile(String prefix, String suffix) throws IOException { - return createTempFile (prefix, suffix, null); + return createTempFile(prefix, suffix, null); } /** @@ -1168,7 +1169,7 @@ public class File implements Serializable, Comparable * * @since 1.2 */ - public int compareTo (File other) + public int compareTo(File other) { if (caseSensitive) return path.compareTo (other.path); @@ -1197,9 +1198,9 @@ public class File implements Serializable, Comparable * * @since 1.2 */ - public int compareTo (Object obj) + public int compareTo(Object obj) { - return compareTo ((File) obj); + return compareTo((File) obj); } /* @@ -1219,7 +1220,7 @@ public class File implements Serializable, Comparable * @exception SecurityException If write access is not allowed to the * file by the <code>SecurityMananger</code>. */ - public synchronized boolean renameTo (File dest) + public synchronized boolean renameTo(File dest) { SecurityManager s = System.getSecurityManager(); String sname = getName(); @@ -1253,7 +1254,7 @@ public class File implements Serializable, Comparable * * @since 1.2 */ - public boolean setLastModified (long time) + public boolean setLastModified(long time) { if (time < 0) throw new IllegalArgumentException("Negative modification time: " + time); @@ -1268,7 +1269,7 @@ public class File implements Serializable, Comparable SecurityManager s = System.getSecurityManager(); if (s != null) - s.checkWrite (path); + s.checkWrite(path); } private void checkRead() @@ -1277,7 +1278,7 @@ public class File implements Serializable, Comparable SecurityManager s = System.getSecurityManager(); if (s != null) - s.checkRead (path); + s.checkRead(path); } /** @@ -1299,13 +1300,13 @@ public class File implements Serializable, Comparable FileDeleter.add (this); } - private void writeObject (ObjectOutputStream oos) throws IOException + private void writeObject(ObjectOutputStream oos) throws IOException { oos.defaultWriteObject(); - oos.writeChar (separatorChar); + oos.writeChar(separatorChar); } - private void readObject (ObjectInputStream ois) + private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { ois.defaultReadObject(); @@ -1315,7 +1316,7 @@ public class File implements Serializable, Comparable char oldSeparatorChar = ois.readChar(); if (oldSeparatorChar != separatorChar) - path = path.replace (oldSeparatorChar, separatorChar); + path = path.replace(oldSeparatorChar, separatorChar); } } // class File |