Commit 1470f196 by Gary Benson Committed by Gary Benson

File.java (internalExists): New method.

2006-07-14  Gary Benson  <gbenson@redhat.com>

	* java/io/File.java (internalExists): New method.
	(exists): Use internalExists.
	(internalIsDirectory): New method.
	(isDirectory): Use internalIsDirectory.
	(createTempFile): Use internalExists and internalIsDirectory.

From-SVN: r115441
parent 8c2e5f36
2006-07-14 Gary Benson <gbenson@redhat.com>
* java/io/File.java (internalExists): New method.
(exists): Use internalExists.
(internalIsDirectory): New method.
(isDirectory): Use internalIsDirectory.
(createTempFile): Use internalExists and internalIsDirectory.
2006-07-13 Bryce McKinlay <mckinlay@redhat.com> 2006-07-13 Bryce McKinlay <mckinlay@redhat.com>
* interpret.cc (_Jv_InterpMethod::run): Don't SAVE_PC for fdiv. * interpret.cc (_Jv_InterpMethod::run): Don't SAVE_PC for fdiv.
......
...@@ -259,6 +259,15 @@ public class File implements Serializable, Comparable ...@@ -259,6 +259,15 @@ public class File implements Serializable, Comparable
return path.equalsIgnoreCase(other.path); return path.equalsIgnoreCase(other.path);
} }
/*
* This method tests whether or not the file represented by the
* object actually exists on the filesystem.
*/
private boolean internalExists()
{
return _access (EXISTS);
}
/** /**
* This method tests whether or not the file represented by the object * This method tests whether or not the file represented by the object
* actually exists on the filesystem. * actually exists on the filesystem.
...@@ -270,7 +279,7 @@ public class File implements Serializable, Comparable ...@@ -270,7 +279,7 @@ public class File implements Serializable, Comparable
public boolean exists() public boolean exists()
{ {
checkRead(); checkRead();
return _access (EXISTS); return internalExists();
} }
/** /**
...@@ -685,6 +694,15 @@ public class File implements Serializable, Comparable ...@@ -685,6 +694,15 @@ public class File implements Serializable, Comparable
*/ */
public native boolean isAbsolute(); public native boolean isAbsolute();
/*
* This method tests whether or not the file represented by this
* object is a directory.
*/
private boolean internalIsDirectory()
{
return _stat (DIRECTORY);
}
/** /**
* This method tests whether or not the file represented by this object * This method tests whether or not the file represented by this object
* is a directory. In order for this method to return <code>true</code>, * is a directory. In order for this method to return <code>true</code>,
...@@ -698,7 +716,7 @@ public class File implements Serializable, Comparable ...@@ -698,7 +716,7 @@ public class File implements Serializable, Comparable
public boolean isDirectory() public boolean isDirectory()
{ {
checkRead(); checkRead();
return _stat (DIRECTORY); return internalIsDirectory();
} }
/** /**
...@@ -1069,10 +1087,10 @@ public class File implements Serializable, Comparable ...@@ -1069,10 +1087,10 @@ public class File implements Serializable, Comparable
throw new IOException("Cannot determine system temporary directory"); throw new IOException("Cannot determine system temporary directory");
directory = new File(dirname); directory = new File(dirname);
if (!directory.exists()) if (!directory.internalExists())
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.internalIsDirectory())
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.");
......
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