Commit cff5cdc8 by Michael Koch Committed by Michael Koch

2003-06-21 Michael Koch <konqueror@gmx.de>

	* java/io/File.java
	(static): Load javaio lib if existing (only in classpath).
	(File): Revised documentation to show the correct argument name.
	(createTempFile): Partly merged with classpath.
	(compareTo): Simplified.
	(lastModified): Throw exception if time < 0.
	(deleteOnExit): Revised documentation.

From-SVN: r68310
parent 84cc377e
2003-06-21 Michael Koch <konqueror@gmx.de> 2003-06-21 Michael Koch <konqueror@gmx.de>
* java/io/File.java
(static): Load javaio lib if existing (only in classpath).
(File): Revised documentation to show the correct argument name.
(createTempFile): Partly merged with classpath.
(compareTo): Simplified.
(lastModified): Throw exception if time < 0.
(deleteOnExit): Revised documentation.
2003-06-21 Michael Koch <konqueror@gmx.de>
* java/net/PlainSocketImpl.java: * java/net/PlainSocketImpl.java:
Reformatted. Reformatted.
(PlainSocketImpl): Merged class documentaion with classpath. (PlainSocketImpl): Merged class documentaion with classpath.
......
...@@ -40,6 +40,7 @@ package java.io; ...@@ -40,6 +40,7 @@ package java.io;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import gnu.classpath.Configuration;
import gnu.gcj.runtime.FileDeleter; import gnu.gcj.runtime.FileDeleter;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
...@@ -111,7 +112,6 @@ public class File implements Serializable, Comparable ...@@ -111,7 +112,6 @@ public class File implements Serializable, Comparable
*/ */
public static final char pathSeparatorChar = pathSeparator.charAt(0); public static final char pathSeparatorChar = pathSeparator.charAt(0);
static final String tmpdir = System.getProperty("java.io.tmpdir"); static final String tmpdir = System.getProperty("java.io.tmpdir");
static int maxPathLen; static int maxPathLen;
static boolean caseSensitive; static boolean caseSensitive;
...@@ -119,7 +119,12 @@ public class File implements Serializable, Comparable ...@@ -119,7 +119,12 @@ public class File implements Serializable, Comparable
static static
{ {
init_native(); if (Configuration.INIT_LOAD_LIBRARY)
{
System.loadLibrary ("javaio");
}
init_native ();
} }
// Native function called at class initialization. This should should // Native function called at class initialization. This should should
...@@ -345,7 +350,7 @@ public class File implements Serializable, Comparable ...@@ -345,7 +350,7 @@ public class File implements Serializable, Comparable
* name. If the directory path name ends in the separator string, another * name. If the directory path name ends in the separator string, another
* separator string will still be appended. * separator string will still be appended.
* *
* @param dirname The path to the directory the file resides in * @param dirPath The path to the directory the file resides in
* @param name The name of the file * @param name The name of the file
*/ */
public File (String dirPath, String name) public File (String dirPath, String name)
...@@ -711,7 +716,6 @@ public class File implements Serializable, Comparable ...@@ -711,7 +716,6 @@ public class File implements Serializable, Comparable
* This native function actually produces the list of file in this * This native function actually produces the list of file in this
* directory * directory
*/ */
private final native Object[] performList (FilenameFilter filter, private final native Object[] performList (FilenameFilter filter,
FileFilter fileFilter, FileFilter fileFilter,
Class result_type); Class result_type);
...@@ -986,19 +990,19 @@ public class File implements Serializable, Comparable ...@@ -986,19 +990,19 @@ public class File implements Serializable, Comparable
{ {
String dirname = tmpdir; String dirname = tmpdir;
if (dirname == null) if (dirname == null)
throw throw new IOException ("Cannot determine system temporary directory");
new IOException ("Cannot determine system temporary directory");
directory = new File (dirname); directory = new File (dirname);
if (!directory.exists ()) if (!directory.exists ())
throw new IOException ("System temporary directory " throw new IOException ("System temporary directory "
+ directory.getName() + " does not exist."); + directory.getName () + " does not exist.");
if (!directory.isDirectory()) if (!directory.isDirectory ())
throw new IOException ("System temporary directory " throw new IOException ("System temporary directory "
+ directory.getName() + directory.getName ()
+ " is not really a directory."); + " is not really a directory.");
} }
// Now process the prefix and suffix.
if (prefix.length () < 3) if (prefix.length () < 3)
throw new IllegalArgumentException ("Prefix too short: " + prefix); throw new IllegalArgumentException ("Prefix too short: " + prefix);
...@@ -1162,7 +1166,7 @@ public class File implements Serializable, Comparable ...@@ -1162,7 +1166,7 @@ public class File implements Serializable, Comparable
* *
* @since 1.2 * @since 1.2
*/ */
public int compareTo(File other) public int compareTo (File other)
{ {
if (caseSensitive) if (caseSensitive)
return path.compareTo (other.path); return path.compareTo (other.path);
...@@ -1191,10 +1195,9 @@ public class File implements Serializable, Comparable ...@@ -1191,10 +1195,9 @@ public class File implements Serializable, Comparable
* *
* @since 1.2 * @since 1.2
*/ */
public int compareTo(Object o) public int compareTo (Object obj)
{ {
File other = (File) o; return compareTo ((File) obj);
return compareTo (other);
} }
/* /*
...@@ -1250,6 +1253,9 @@ public class File implements Serializable, Comparable ...@@ -1250,6 +1253,9 @@ public class File implements Serializable, Comparable
*/ */
public boolean setLastModified (long time) public boolean setLastModified (long time)
{ {
if (time < 0)
throw new IllegalArgumentException("Negative modification time: " + time);
checkWrite (); checkWrite ();
return performSetLastModified(time); return performSetLastModified(time);
} }
...@@ -1276,6 +1282,8 @@ public class File implements Serializable, Comparable ...@@ -1276,6 +1282,8 @@ public class File implements Serializable, Comparable
* Add this File to the set of files to be deleted upon normal * Add this File to the set of files to be deleted upon normal
* termination. * termination.
* *
* @exception SecurityException If deleting of the file is not allowed
*
* @since 1.2 * @since 1.2
*/ */
// FIXME: This should use the ShutdownHook API once we implement that. // FIXME: This should use the ShutdownHook API once we implement that.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment