diff options
author | Andrew John Hughes <gandalf@gcc.gnu.org> | 2012-03-23 15:19:26 +0000 |
---|---|---|
committer | Andrew John Hughes <gandalf@gcc.gnu.org> | 2012-03-23 15:19:26 +0000 |
commit | 0563022a206294757effa44686727bffc4f7c2bd (patch) | |
tree | febe3d4d4c0c994db223fee8e819bde6582494c9 /libjava/classpath/vm/reference/java/io | |
parent | 21669dfe20db0246ece395db5558a081a5c7088f (diff) | |
download | gcc-0563022a206294757effa44686727bffc4f7c2bd.zip gcc-0563022a206294757effa44686727bffc4f7c2bd.tar.gz gcc-0563022a206294757effa44686727bffc4f7c2bd.tar.bz2 |
Merge GNU Classpath 0.99 into libjava.
From-SVN: r185741
Diffstat (limited to 'libjava/classpath/vm/reference/java/io')
4 files changed, 103 insertions, 40 deletions
diff --git a/libjava/classpath/vm/reference/java/io/VMConsole.java b/libjava/classpath/vm/reference/java/io/VMConsole.java new file mode 100644 index 0000000..69c9df9 --- /dev/null +++ b/libjava/classpath/vm/reference/java/io/VMConsole.java @@ -0,0 +1,44 @@ +/* VMConsole.java -- helper for java.io.Console + Copyright (C) 2012 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.io; + +public final class VMConsole +{ + static native String readPassword(Console con); +} diff --git a/libjava/classpath/vm/reference/java/io/VMFile.java b/libjava/classpath/vm/reference/java/io/VMFile.java index 2af1e95..f2ac5c3 100644 --- a/libjava/classpath/vm/reference/java/io/VMFile.java +++ b/libjava/classpath/vm/reference/java/io/VMFile.java @@ -1,5 +1,5 @@ /* VMFile.java -- Class for methods natively accessing files - Copyright (C) 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,7 @@ import gnu.java.io.PlatformHelper; */ final class VMFile { + // FIXME: We support only case sensitive filesystems currently. static final boolean IS_CASE_SENSITIVE = true; static final boolean IS_DOS_8_3 = false; @@ -62,105 +63,113 @@ final class VMFile } } - /* + private VMFile() {} // Prohibits instantiation. + + /** * This native method does the actual work of getting the last file * modification time. It also does the existence check to avoid the - * overhead of a call to exists() + * overhead of a call to exists(). */ static native long lastModified(String path); - /* + /** * This native method sets the permissions to make the file read only. + * + * @return true if file exists and the operation completed successfully */ static native boolean setReadOnly(String path); /** - * This method is used to create a temporary file + * This method is used to create a temporary file. */ static native boolean create(String path) throws IOException; - /* + /** * This native function actually produces the list of files in this - * directory + * directory. + * + * @return null if dirpath does not exist or is not a directory; + * null or empty array if the directory is unreadable; an array of + * file names in the directory otherwise. */ static native synchronized String[] list(String dirpath); - /* + /** * This native method actually performs the rename. */ static native boolean renameTo(String targetpath, String destpath); - /* + /** * This native method actually determines the length of the file and - * handles the existence check + * handles the existence check. */ static native long length(String path); - /* + /** * This native method does the actual checking of file existence. */ static native boolean exists(String path); - /* - * This native method handles the actual deleting of the file + /** + * This native method handles the actual deleting of the file. */ static native boolean delete(String path); - /* + /** * This method does the actual setting of the modification time. */ static native boolean setLastModified(String path, long time); - /* - * This native method actually creates the directory + /** + * This native method actually creates the directory. */ static native boolean mkdir(String dirpath); /** * Gets the total bytes of the filesystem named by path. */ - public static native long getTotalSpace(String path); + static native long getTotalSpace(String path); /** * Gets the total free bytes of the filesystem named by path. */ - public static native long getFreeSpace(String path); + static native long getFreeSpace(String path); /** * Gets the available bytes of the filesystem named by path. */ - public static native long getUsableSpace(String path); + static native long getUsableSpace(String path); /** * Set the read permission of the file. */ - public static synchronized native boolean setReadable(String path, - boolean readable, - boolean ownerOnly); + static synchronized native boolean setReadable(String path, + boolean readable, + boolean ownerOnly); /** * Set the write permission of the file. */ - public static synchronized native boolean setWritable(String path, - boolean writable, - boolean ownerOnly); + static synchronized native boolean setWritable(String path, + boolean writable, + boolean ownerOnly); /** * Set the execute permission of the file. */ - public static synchronized native boolean setExecutable(String path, - boolean executable, - boolean ownerOnly); + static synchronized native boolean setExecutable(String path, + boolean executable, + boolean ownerOnly); - /* + /** * This native method does the actual check of whether or not a file * is a plain file or not. It also handles the existence check to - * eliminate the overhead of a call to exists() + * eliminate the overhead of a call to exists(). */ static native boolean isFile(String path); /** - * This native method checks file permissions for writing + * This native method checks file permissions for writing. */ static synchronized native boolean canWrite(String path); @@ -170,19 +179,23 @@ final class VMFile static native boolean canWriteDirectory(String path); /** - * This native method checks file permissions for reading + * This native method checks file permissions for reading. + * It also handles the existence check to eliminate the overhead of + * a call to exists(). */ static synchronized native boolean canRead(String path); /** - * This native method checks file permissions for execution + * This native method checks file permissions for execution. + * It also handles the existence check to eliminate the overhead of + * a call to exists(). */ static synchronized native boolean canExecute(String path); - /* + /** * This method does the actual check of whether or not a file is a - * directory or not. It also handle the existence check to eliminate - * the overhead of a call to exists() + * directory or not. It also handles the existence check to eliminate + * the overhead of a call to exists(). */ static native boolean isDirectory(String dirpath); @@ -359,9 +372,9 @@ final class VMFile * <p> * Note that this method, unlike the other methods which return path * names, can throw an IOException. This is because native method - * might be required in order to resolve the canonical path + * might be required in order to resolve the canonical path. * * @exception IOException If an error occurs */ - public static native String toCanonicalForm(String path) throws IOException; + static native String toCanonicalForm(String path) throws IOException; } diff --git a/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java b/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java index 10e1f34..a29115b 100644 --- a/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java +++ b/libjava/classpath/vm/reference/java/io/VMObjectInputStream.java @@ -1,5 +1,5 @@ /* ObjectInputStream.java -- Class used to read serialized objects - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,6 +44,7 @@ import java.lang.reflect.Constructor; final class VMObjectInputStream { + static { if (Configuration.INIT_LOAD_LIBRARY) @@ -52,6 +53,8 @@ final class VMObjectInputStream } } + private VMObjectInputStream() {} // Prohibits instantiation. + /** * Allocates a new Object of type clazz but without running the * default constructor on it. It then calls the given constructor on diff --git a/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java b/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java index fbaf7d6..6a78d8e 100644 --- a/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java +++ b/libjava/classpath/vm/reference/java/io/VMObjectStreamClass.java @@ -1,5 +1,5 @@ /* VMObjectStreamClass.java -- VM helper functions for ObjectStreamClass - Copyright (C) 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 2003, 2005, 2010 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -43,6 +43,7 @@ import java.lang.reflect.Field; final class VMObjectStreamClass { + static { if (Configuration.INIT_LOAD_LIBRARY) @@ -51,6 +52,8 @@ final class VMObjectStreamClass } } + private VMObjectStreamClass() {} // Prohibits instantiation. + /** * Returns true if CLAZZ has a static class initializer * (a.k.a. <clinit>). |