diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 2d8025edd2d..16697a7c35f 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,31 @@ +2003-03-18 Michael Koch + + * java/io/BufferedReader.java, + java/io/BufferedWriter.java, + java/io/ByteArrayOutputStream.java, + java/io/FileFilter.java, + java/io/FilePermission.java, + java/io/FileReader.java, + java/io/FileWriter.java, + java/io/FilenameFilter.java, + java/io/FilterInputStream.java, + java/io/FilterOutputStream.java, + java/io/FilterReader.java, + java/io/FilterWriter.java, + java/io/ObjectInput.java, + java/io/ObjectInputValidation.java, + java/io/ObjectOutput.java, + java/io/ObjectStreamField.java, + java/io/PipedInputStream.java, + java/io/PipedReader.java, + java/io/PrintWriter.java, + java/io/PushbackReader.java, + java/io/Reader.java, + java/io/SerializablePermission.java, + java/io/StringReader.java, + java/io/Writer.java: + Merged from classpath. + 2003-03-17 Michael Koch * java/awt/ScrollPaneAdjustable.java: diff --git a/libjava/java/io/BufferedReader.java b/libjava/java/io/BufferedReader.java index b4cdb639b43..a40015b32d6 100644 --- a/libjava/java/io/BufferedReader.java +++ b/libjava/java/io/BufferedReader.java @@ -243,7 +243,8 @@ public class BufferedReader extends Reader * This method returns false then this stream could (but is * not guaranteed to) block on the next read attempt. * - * @return true if this stream is ready to be read, false otherwise + * @return true if this stream is ready to be read, + * false otherwise * * @exception IOException If an error occurs */ @@ -258,7 +259,8 @@ public class BufferedReader extends Reader /** * This method read chars from a stream and stores them into a caller - * supplied buffer. It starts storing the data at index offset into + * supplied buffer. It starts storing the data at index + * offset into * the buffer and attempts to read len chars. This method can * return before reading the number of chars requested. The actual number * of chars read is returned as an int. A -1 is returned to indicate the @@ -473,7 +475,8 @@ public class BufferedReader extends Reader * requested amount. *

* This method first discards chars in the buffer, then calls the - * skip method on the underlying stream to skip the remaining chars. + * skip method on the underlying stream to skip the + * remaining chars. * * @param num_chars The requested number of chars to skip * diff --git a/libjava/java/io/BufferedWriter.java b/libjava/java/io/BufferedWriter.java index d5e5bf849d8..b7837843cd3 100644 --- a/libjava/java/io/BufferedWriter.java +++ b/libjava/java/io/BufferedWriter.java @@ -51,8 +51,6 @@ package java.io; * efficient mechanism for writing versus doing numerous small unbuffered * writes. * - * @version 0.0 - * * @author Aaron M. Renn (arenn@urbanophile.com) * @author Tom Tromey * @date September 25, 1998 diff --git a/libjava/java/io/ByteArrayOutputStream.java b/libjava/java/io/ByteArrayOutputStream.java index a8d8f22d684..bb5b869a391 100644 --- a/libjava/java/io/ByteArrayOutputStream.java +++ b/libjava/java/io/ByteArrayOutputStream.java @@ -65,8 +65,6 @@ package java.io; * application specified character encoding. Thus it can handle * multibyte character encodings. * - * @version 0.0 - * * @author Aaron M. Renn (arenn@urbanophile.com) * @author Tom Tromey * @date September 24, 1998 diff --git a/libjava/java/io/FileFilter.java b/libjava/java/io/FileFilter.java index faa4a7b451f..4cfdb01d6f4 100644 --- a/libjava/java/io/FileFilter.java +++ b/libjava/java/io/FileFilter.java @@ -46,23 +46,21 @@ package java.io; * The method in this interface determines if a particular pathname should * or should not be included in the pathname listing. * - * @version 0.0 - * * @author Aaron M. Renn (arenn@urbanophile.com) */ public interface FileFilter { -/** - * This method determines whether or not a given pathname should be included - * in a pathname listing. - * - * @param pathname The pathname to test - * - * @return true if the path should be included in the list, false otherwise. - */ -public abstract boolean -accept(File pathname); + /** + * This method determines whether or not a given pathname should be included + * in a pathname listing. + * + * @param pathname The pathname to test + * + * @return true if the path should be included in the list, + * false otherwise. + */ + public abstract boolean accept(File pathname); } // interface FileFilter diff --git a/libjava/java/io/FilePermission.java b/libjava/java/io/FilePermission.java index 0fc06c91473..95aa4207785 100644 --- a/libjava/java/io/FilePermission.java +++ b/libjava/java/io/FilePermission.java @@ -1,5 +1,5 @@ /* java.lang.FilePermission - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -45,7 +45,8 @@ public final class FilePermission extends Permission implements Serializable { static final long serialVersionUID = 7930732926638008763L; - private static final String CURRENT_DIRECTORY = System.getProperty("user.dir"); + private static final String CURRENT_DIRECTORY = + System.getProperty("user.dir"); private boolean usingPerms = false; private boolean readPerm = false; private boolean writePerm = false; @@ -53,26 +54,28 @@ public final class FilePermission extends Permission implements Serializable private boolean deletePerm = false; private String actionsString; - private void cachePerms() { + private void cachePerms() + { // While race conditions could occur, they don't matter at all. String action; int i = actionsString.indexOf(','); int startI = 0; - while(i != -1) { - action = actionsString.substring(startI,i); - if(action.equals("read")) - readPerm = true; - else if(action.equals("write")) - writePerm = true; - else if(action.equals("execute")) - executePerm = true; - else if(action.equals("delete")) - deletePerm = true; + while(i != -1) + { + action = actionsString.substring(startI,i); + if(action.equals("read")) + readPerm = true; + else if(action.equals("write")) + writePerm = true; + else if(action.equals("execute")) + executePerm = true; + else if(action.equals("delete")) + deletePerm = true; - startI = i+1; - i = actionsString.indexOf(',',startI); - } + startI = i+1; + i = actionsString.indexOf(',',startI); + } action = actionsString.substring(startI); if(action.equals("read")) @@ -93,25 +96,29 @@ public final class FilePermission extends Permission implements Serializable ** @XXX what to do when the file string is malformed? **/ public FilePermission(String pathExpression, String actionsString) - { - super(pathExpression); - this.actionsString = actionsString; - } + { + super(pathExpression); + this.actionsString = actionsString; + } /** Get the actions this FilePermission supports. ** @return the String representing the actions this FilePermission supports. **/ - public String getActions() { + public String getActions() + { return actionsString; } /** Get the hash code for this Object.

- ** FilePermission's hash code is calculated as the exclusive or of the target + ** FilePermission's hash code is calculated as the exclusive or of the + ** target ** String's hash code and the action String's hash code. - ** @specnote Sun did not specify how to calculate the hash code; I made this up. + ** @specnote Sun did not specify how to calculate the hash code; + ** I made this up. ** @return the hash code for this Object. **/ - public int hashCode() { + public int hashCode() + { return getName().hashCode() ^ actionsString.hashCode(); } @@ -121,7 +128,8 @@ public final class FilePermission extends Permission implements Serializable ** @param o the Object to compare to. ** @return whether the Objects are semantically equivalent. **/ - public boolean equals(Object o) { + public boolean equals(Object o) + { if(!(o instanceof FilePermission)) return false; FilePermission p = (FilePermission)o; @@ -136,23 +144,32 @@ public final class FilePermission extends Permission implements Serializable /* Compare names, taking into account if they refer to a * directory and one has a separator and the other does not. */ - if(f1.charAt(f1.length()) == File.separatorChar) { - if(f2.charAt(f2.length()) == File.separatorChar) { - if(!f2.equals(f1)) - return false; - } else { - if(!f2.equals(f1.substring(0,f1.length()-1))) - return false; - } - } else { - if(f2.charAt(f2.length()) == File.separatorChar) { - if(!f1.equals(f2.substring(0,f2.length()-1))) - return false; - } else { - if(!f1.equals(f2)) - return false; - } - } + if(f1.charAt(f1.length()) == File.separatorChar) + { + if(f2.charAt(f2.length()) == File.separatorChar) + { + if(!f2.equals(f1)) + return false; + } + else + { + if(!f2.equals(f1.substring(0,f1.length()-1))) + return false; + } + } + else + { + if(f2.charAt(f2.length()) == File.separatorChar) + { + if(!f1.equals(f2.substring(0,f2.length()-1))) + return false; + } + else + { + if(!f1.equals(f2)) + return false; + } + } return readPerm == p.readPerm && writePerm == p.writePerm && executePerm == p.executePerm && deletePerm == p.deletePerm; } @@ -160,13 +177,15 @@ public final class FilePermission extends Permission implements Serializable ** Permission A implies permission B if these things are all true: **

    **
  1. A and B are both FilePermissions.
  2. - **
  3. All possible files in B are included in A (possibly more are in A).
  4. + **
  5. All possible files in B are included in A + ** (possibly more are in A).
  6. **
  7. All actions B supports, A also supports.
  8. **
** @param p the Permission to compare against. ** @return whether this Permission implies p **/ - public boolean implies(Permission p) { + public boolean implies(Permission p) + { FilePermission fp; if(!(p instanceof FilePermission)) return false; @@ -174,48 +193,67 @@ public final class FilePermission extends Permission implements Serializable String f1 = getName(); String f2 = fp.getName(); - if(f1.charAt(0) != File.separatorChar) { - f1 = CURRENT_DIRECTORY + f1; - } - if(f2.charAt(0) != File.separatorChar) { - f2 = CURRENT_DIRECTORY + f2; - } + if(f1.charAt(0) != File.separatorChar) + { + f1 = CURRENT_DIRECTORY + f1; + } + if(f2.charAt(0) != File.separatorChar) + { + f2 = CURRENT_DIRECTORY + f2; + } String sub1, sub2a, sub2b; - switch(f1.charAt(f1.length() - 1)) { - case '*': - sub1 = f1.substring(0,f1.length() - 1); // chop off "*" - if(f2.length() <= sub1.length()) { - /* If it's smaller, there is no way it could be part of this directory. - * If it's the same (or length - 1), it could be the same directory but - * specifies access to the directory rather than the files in it. - */ - return false; - } else if(f2.charAt(sub1.length() - 1) == File.separatorChar) { - /* Make sure the part before the "/" is the same */ - if(!f2.substring(0,sub1.length()).equals(sub1)) - return false; - /* Make sure there are no subdirectories specified underneath this one */ - String sub2 = f2.substring(sub1.length()+1); - if(f2.substring(sub1.length()+1).indexOf(File.separatorChar) != -1) - return false; - } else { - /* Obviously not equal: f2 is either not a directory or is not - * the same directory (its name continues further than we want) - */ - return false; - } - break; - case '-': - sub1 = f1.substring(0,f1.length() - 2); // chop off "/-" - if(f2.length() < sub1.length()) { - /* If it's smaller, there is no way it could be part of this directory. */ - return false; - } else if(f2.length() > sub1.length() && f2.charAt(sub1.length()) != File.separatorChar) { - return false; - } else if(!f2.substring(0,sub1.length()).equals(sub1)) - return false; - break; + switch(f1.charAt(f1.length() - 1)) + { + case '*': + sub1 = f1.substring(0,f1.length() - 1); // chop off "*" + if(f2.length() <= sub1.length()) + { + /* If it's smaller, there is no way it could be part of this + * directory. + * If it's the same (or length - 1), it could be the same + * directory but + * specifies access to the directory rather than the files in it. + */ + return false; + } + else if(f2.charAt(sub1.length() - 1) == File.separatorChar) + { + /* Make sure the part before the "/" is the same */ + if(!f2.substring(0,sub1.length()).equals(sub1)) + return false; + /* Make sure there are no subdirectories specified + underneath this one */ + String sub2 = f2.substring(sub1.length()+1); + if(f2.substring(sub1.length()+1).indexOf(File.separatorChar) + != -1) + return false; + } + else + { + /* Obviously not equal: f2 is either not a directory or is not + * the same directory (its name continues further than we want) + */ + return false; + } + break; + case '-': + sub1 = f1.substring(0,f1.length() - 2); // chop off "/-" + if(f2.length() < sub1.length()) + { + /* If it's smaller, there is no way it could be part of + * this directory. */ + return false; + } + else if(f2.length() > sub1.length() && f2.charAt(sub1.length()) + != File.separatorChar) + { + return false; + + } + else if(!f2.substring(0,sub1.length()).equals(sub1)) + return false; + break; /* Looks redundant with default case and won't compile anyway - arenn case File.separatorChar: if(f2.charAt(f2.length()) == File.separatorChar) { @@ -227,16 +265,19 @@ public final class FilePermission extends Permission implements Serializable } break; */ - default: - if(f2.charAt(f2.length()) == File.separatorChar) { - if(!f1.equals(f2.substring(0,f2.length()-1))) - return false; - } else { - if(!f1.equals(f2)) - return false; + default: + if(f2.charAt(f2.length()) == File.separatorChar) + { + if(!f1.equals(f2.substring(0,f2.length()-1))) + return false; + } + else + { + if(!f1.equals(f2)) + return false; + } + break; } - break; - } if(!usingPerms) cachePerms(); @@ -254,4 +295,5 @@ public final class FilePermission extends Permission implements Serializable return true; } -} +} // class FilePermission + diff --git a/libjava/java/io/FileReader.java b/libjava/java/io/FileReader.java index 9bd271cfe04..c18613852ab 100644 --- a/libjava/java/io/FileReader.java +++ b/libjava/java/io/FileReader.java @@ -1,5 +1,5 @@ /* FileReader.java -- Convenience class for reading characters from a file - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,8 +46,6 @@ package java.io; * to read from files using the default character encoding. Use * InputStreamReader directly to use a non-default encoding. * - * @version 0.0 - * * @author Aaron M. Renn (arenn@urbanophile.com) */ public class FileReader extends InputStreamReader @@ -90,4 +88,5 @@ public class FileReader extends InputStreamReader { super(new FileInputStream(name)); } -} +} // class FileReader + diff --git a/libjava/java/io/FileWriter.java b/libjava/java/io/FileWriter.java index 265f31cce64..5217f9ecc33 100644 --- a/libjava/java/io/FileWriter.java +++ b/libjava/java/io/FileWriter.java @@ -54,84 +54,82 @@ package java.io; public class FileWriter extends OutputStreamWriter { -/*************************************************************************/ + /*************************************************************************/ -/* - * Constructors - */ - -/** - * This method initializes a new FileWriter object to write - * to the specified File object. - * - * @param file The File object to write to. - * - * @param SecurityException If writing to this file is forbidden by the - * SecurityManager. - * @param IOException If any other error occurs - */ -public -FileWriter(File file) throws SecurityException, IOException -{ - super(new FileOutputStream(file)); -} + /* + * Constructors + */ + + /** + * This method initializes a new FileWriter object to write + * to the specified File object. + * + * @param file The File object to write to. + * + * @param SecurityException If writing to this file is forbidden by the + * SecurityManager. + * @param IOException If any other error occurs + */ + public FileWriter(File file) throws SecurityException, IOException + { + super(new FileOutputStream(file)); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method initializes a new FileWriter object to write - * to the specified FileDescriptor object. - * - * @param fd The FileDescriptor object to write to - * - * @param SecurityException If writing to this file is forbidden by the - * SecurityManager. - */ -public -FileWriter(FileDescriptor fd) throws SecurityException -{ - super(new FileOutputStream(fd)); -} + /** + * This method initializes a new FileWriter object to write + * to the specified FileDescriptor object. + * + * @param fd The FileDescriptor object to write to + * + * @param SecurityException If writing to this file is forbidden by the + * SecurityManager. + */ + public FileWriter(FileDescriptor fd) throws SecurityException + { + super(new FileOutputStream(fd)); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method intializes a new FileWriter object to write to the - * specified named file. - * - * @param name The name of the file to write to - * - * @param SecurityException If writing to this file is forbidden by the - * SecurityManager. - * @param IOException If any other error occurs - */ -public -FileWriter(String name) throws IOException -{ - super(new FileOutputStream(name)); -} + /** + * This method intializes a new FileWriter object to + * write to the + * specified named file. + * + * @param name The name of the file to write to + * + * @param SecurityException If writing to this file is forbidden by the + * SecurityManager. + * @param IOException If any other error occurs + */ + public FileWriter(String name) throws IOException + { + super(new FileOutputStream(name)); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method intializes a new FileWriter object to write to the - * specified named file. This form of the constructor allows the caller - * to determin whether data should be written starting at the beginning or - * the end of the file. - * - * @param name The name of the file to write to - * @param append true to start adding data at the end of the - * file, false otherwise. - * - * @param SecurityException If writing to this file is forbidden by the - * SecurityManager. - * @param IOException If any other error occurs - */ -public -FileWriter(String name, boolean append) throws IOException -{ - super(new FileOutputStream(name, append)); -} + /** + * This method intializes a new FileWriter object to + * write to the + * specified named file. This form of the constructor allows the caller + * to determin whether data should be written starting at the beginning or + * the end of the file. + * + * @param name The name of the file to write to + * @param append true to start adding data at the end of the + * file, false otherwise. + * + * @param SecurityException If writing to this file is forbidden by the + * SecurityManager. + * @param IOException If any other error occurs + */ + public FileWriter(String name, boolean append) throws IOException + { + super(new FileOutputStream(name, append)); + } } // class FileWriter diff --git a/libjava/java/io/FilenameFilter.java b/libjava/java/io/FilenameFilter.java index 68ff6a363b1..df0509adadd 100644 --- a/libjava/java/io/FilenameFilter.java +++ b/libjava/java/io/FilenameFilter.java @@ -57,17 +57,17 @@ package java.io; public interface FilenameFilter { -/** - * This method determines whether or not a given file should be included - * in a directory listing. - * - * @param dir The File instance for the directory being read - * @param name The name of the file to test - * - * @return true if the file should be included in the list, - * false otherwise. - */ -boolean -accept(File dir, String name); + /** + * This method determines whether or not a given file should be included + * in a directory listing. + * + * @param dir The File instance for the directory being read + * @param name The name of the file to test + * + * @return true if the file should be included in the list, + * false otherwise. + */ + boolean accept(File dir, String name); } // interface FilenameFilter + diff --git a/libjava/java/io/FilterInputStream.java b/libjava/java/io/FilterInputStream.java index 7176b596423..80cbd927375 100644 --- a/libjava/java/io/FilterInputStream.java +++ b/libjava/java/io/FilterInputStream.java @@ -70,179 +70,171 @@ package java.io; public class FilterInputStream extends InputStream { -/*************************************************************************/ + /*************************************************************************/ -/* - * Instance Variables - */ + /* + * Instance Variables + */ -/** - * This is the subordinate InputStream to which method calls - * are redirected - */ -protected InputStream in; + /** + * This is the subordinate InputStream to which method calls + * are redirected + */ + protected InputStream in; -/*************************************************************************/ + /*************************************************************************/ -/* - * Constructors - */ + /* + * Constructors + */ -/** - * Create a FilterInputStream with the specified subordinate - * InputStream. - * - * @param in The subordinate InputStream - */ -protected -FilterInputStream(InputStream in) -{ - this.in = in; -} + /** + * Create a FilterInputStream with the specified subordinate + * InputStream. + * + * @param in The subordinate InputStream + */ + protected FilterInputStream(InputStream in) + { + this.in = in; + } -/*************************************************************************/ + /*************************************************************************/ -/* - * Instance Methods - */ + /* + * Instance Methods + */ -/** - * Calls the in.mark(int) method. - * - * @param readlimit The parameter passed to in.mark(int) - */ -public void -mark(int readlimit) -{ - in.mark(readlimit); -} + /** + * Calls the in.mark(int) method. + * + * @param readlimit The parameter passed to in.mark(int) + */ + public void mark(int readlimit) + { + in.mark(readlimit); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.markSupported() method. - * - * @return true if mark/reset is supported, false - * otherwise - */ -public boolean -markSupported() -{ - return(in.markSupported()); -} + /** + * Calls the in.markSupported() method. + * + * @return true if mark/reset is supported, false + * otherwise + */ + public boolean markSupported() + { + return(in.markSupported()); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.reset() method. - * - * @exception IOException If an error occurs - */ -public void -reset() throws IOException -{ - in.reset(); -} + /** + * Calls the in.reset() method. + * + * @exception IOException If an error occurs + */ + public void reset() throws IOException + { + in.reset(); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.available() method. - * - * @return The value returned from in.available() - * - * @exception IOException If an error occurs - */ -public int -available() throws IOException -{ - return(in.available()); -} + /** + * Calls the in.available() method. + * + * @return The value returned from in.available() + * + * @exception IOException If an error occurs + */ + public int available() throws IOException + { + return(in.available()); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.skip(long) method - * - * @param The requested number of bytes to skip. - * - * @return The value returned from in.skip(long) - * - * @exception IOException If an error occurs - */ -public long -skip(long num_bytes) throws IOException -{ - return(in.skip(num_bytes)); -} + /** + * Calls the in.skip(long) method + * + * @param numBytes The requested number of bytes to skip. + * + * @return The value returned from in.skip(long) + * + * @exception IOException If an error occurs + */ + public long skip(long num_bytes) throws IOException + { + return(in.skip(num_bytes)); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.read() method - * - * @return The value returned from in.read() - * - * @exception IOException If an error occurs - */ -public int -read() throws IOException -{ - return(in.read()); -} + /** + * Calls the in.read() method + * + * @return The value returned from in.read() + * + * @exception IOException If an error occurs + */ + public int read() throws IOException + { + return(in.read()); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the read(byte[], int, int) overloaded method. Note that - * this method does not redirect its call directly to a corresponding - * method in in. This allows subclasses to override only the - * three argument version of read. - * - * @param buf The buffer to read bytes into - * - * @return The value retured from in.read(byte[], int, int) - * - * @exception IOException If an error occurs - */ -public int -read(byte[] buf) throws IOException -{ - return(read(buf, 0, buf.length)); -} + /** + * Calls the read(byte[], int, int) overloaded method. + * Note that + * this method does not redirect its call directly to a corresponding + * method in in. This allows subclasses to override only the + * three argument version of read. + * + * @param buf The buffer to read bytes into + * + * @return The value retured from in.read(byte[], int, int) + * + * @exception IOException If an error occurs + */ + public int read(byte[] buf) throws IOException + { + return(read(buf, 0, buf.length)); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.read(byte[], int, int) method. - * - * @param buf The buffer to read bytes into - * @param offset The index into the buffer to start storing bytes - * @param len The maximum number of bytes to read. - * - * @return The value retured from in.read(byte[], int, int) - * - * @exception IOException If an error occurs - */ -public int -read(byte[] buf, int offset, int len) throws IOException -{ - return(in.read(buf, offset, len)); -} + /** + * Calls the in.read(byte[], int, int) method. + * + * @param buf The buffer to read bytes into + * @param offset The index into the buffer to start storing bytes + * @param len The maximum number of bytes to read. + * + * @return The value retured from in.read(byte[], int, int) + * + * @exception IOException If an error occurs + */ + public int read(byte[] buf, int offset, int len) throws IOException + { + return(in.read(buf, offset, len)); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method closes the input stream by closing the input stream that - * this object is filtering. Future attempts to access this stream may - * throw an exception. - * - * @exception IOException If an error occurs - */ -public void -close() throws IOException -{ - in.close(); -} + /** + * This method closes the input stream by closing the input stream that + * this object is filtering. Future attempts to access this stream may + * throw an exception. + * + * @exception IOException If an error occurs + */ + public void close() throws IOException + { + in.close(); + } } // class FilterInputStream + diff --git a/libjava/java/io/FilterOutputStream.java b/libjava/java/io/FilterOutputStream.java index d6d67c063c7..01204b46109 100644 --- a/libjava/java/io/FilterOutputStream.java +++ b/libjava/java/io/FilterOutputStream.java @@ -1,5 +1,5 @@ /* FilterOutputStream.java -- Parent class for output streams that filter - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -57,126 +57,121 @@ package java.io; public class FilterOutputStream extends OutputStream { -/*************************************************************************/ + /*************************************************************************/ -/* - * Instance Variables - */ + /* + * Instance Variables + */ -/** - * This is the subordinate OutputStream that this class - * redirects its method calls to. - */ -protected OutputStream out; + /** + * This is the subordinate OutputStream that this class + * redirects its method calls to. + */ + protected OutputStream out; -/*************************************************************************/ + /*************************************************************************/ -/* - * Constructors - */ + /* + * Constructors + */ -/** - * This method initializes an instance of FilterOutputStream - * to write to the specified subordinate OutputStream. - * - * @param out The OutputStream to write to - */ -public -FilterOutputStream(OutputStream out) -{ - this.out = out; -} + /** + * This method initializes an instance of FilterOutputStream + * to write to the specified subordinate OutputStream. + * + * @param out The OutputStream to write to + */ + public FilterOutputStream(OutputStream out) + { + this.out = out; + } -/*************************************************************************/ + /*************************************************************************/ -/* - * Instance Methods - */ + /* + * Instance Methods + */ -/** - * This method closes the underlying OutputStream. Any - * further attempts to write to this stream may throw an exception. - * - * @exception IOException If an error occurs - */ -public void -close() throws IOException -{ - flush(); - out.close(); -} + /** + * This method closes the underlying OutputStream. Any + * further attempts to write to this stream may throw an exception. + * + * @exception IOException If an error occurs + */ + public void close() throws IOException + { + flush(); + out.close(); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method attempt to flush all buffered output to be written to the - * underlying output sink. - * - * @exception IOException If an error occurs - */ -public void -flush() throws IOException -{ - out.flush(); -} + /** + * This method attempt to flush all buffered output to be written to the + * underlying output sink. + * + * @exception IOException If an error occurs + */ + public void flush() throws IOException + { + out.flush(); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method writes a single byte of output to the underlying - * OutputStream. - * - * @param b The byte to write, passed as an int. - * - * @exception IOException If an error occurs - */ -public void -write(int b) throws IOException -{ - out.write(b); -} + /** + * This method writes a single byte of output to the underlying + * OutputStream. + * + * @param b The byte to write, passed as an int. + * + * @exception IOException If an error occurs + */ + public void write(int b) throws IOException + { + out.write(b); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method writes all the bytes in the specified array to the underlying - * OutputStream. It does this by calling the three parameter - * version of this method - write(byte[], int, int) in this - * class instead of writing to the underlying OutputStream - * directly. This allows most subclasses to avoid overriding this method. - * - * @param buf The byte array to write bytes from - * - * @exception IOException If an error occurs - */ -public void -write(byte[] buf) throws IOException -{ - // Don't do checking here, per Java Lang Spec. - write(buf, 0, buf.length); -} + /** + * This method writes all the bytes in the specified array to the underlying + * OutputStream. It does this by calling the three parameter + * version of this method - write(byte[], int, int) in this + * class instead of writing to the underlying OutputStream + * directly. This allows most subclasses to avoid overriding this method. + * + * @param buf The byte array to write bytes from + * + * @exception IOException If an error occurs + */ + public void write(byte[] buf) throws IOException + { + // Don't do checking here, per Java Lang Spec. + write(buf, 0, buf.length); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method calls the write(int) method len - * times for all bytes from the array buf starting at index - * offset. Subclasses should overwrite this method to get a - * more efficient implementation. - * - * @param buf The byte array to write bytes from - * @param offset The index into the array to start writing bytes from - * @param len The number of bytes to write - * - * @exception IOException If an error occurs - */ -public void -write(byte[] buf, int offset, int len) throws IOException -{ - // Don't do checking here, per Java Lang Spec. - for (int i=0; i < len; i++) - write(buf[offset + i]); + /** + * This method calls the write(int) method len + * times for all bytes from the array buf starting at index + * offset. Subclasses should overwrite this method to get a + * more efficient implementation. + * + * @param buf The byte array to write bytes from + * @param offset The index into the array to start writing bytes from + * @param len The number of bytes to write + * + * @exception IOException If an error occurs + */ + public void write(byte[] buf, int offset, int len) throws IOException + { + // Don't do checking here, per Java Lang Spec. + for (int i=0; i < len; i++) + write(buf[offset + i]); -} + } } // class FilterOutputStream + diff --git a/libjava/java/io/FilterReader.java b/libjava/java/io/FilterReader.java index 3ccc83d9bc3..22bf6e61897 100644 --- a/libjava/java/io/FilterReader.java +++ b/libjava/java/io/FilterReader.java @@ -1,5 +1,5 @@ /* FilterReader.java -- Base class for char stream classes that filter input - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -63,163 +63,153 @@ package java.io; */ public abstract class FilterReader extends Reader { + /* + * Instance Variables + */ -/*************************************************************************/ + /** + * This is the subordinate Reader to which method calls + * are redirected + */ + protected Reader in; -/* - * Instance Variables - */ + /*************************************************************************/ -/** - * This is the subordinate Reader to which method calls - * are redirected - */ -protected Reader in; + /* + * Constructors + */ -/*************************************************************************/ + /** + * Create a FilterReader with the specified subordinate + * Reader. + * The lock of the new FilterReader will be set + * to in.lock. + * + * @param in The subordinate Reader + */ + protected FilterReader(Reader in) + { + super(in.lock); + this.in = in; + } -/* - * Constructors - */ + /*************************************************************************/ -/** - * Create a FilterReader with the specified subordinate - * Reader. - * The lock of the new FilterReader will be set - * to in.lock. - * - * @param in The subordinate Reader - */ -protected -FilterReader(Reader in) -{ - super(in.lock); - this.in = in; -} + /* + * Instance Methods + */ -/*************************************************************************/ + /** + * Calls the in.mark(int) method. + * + * @param readlimit The parameter passed to in.mark(int) + * + * @exception IOException If an error occurs + */ + public void mark(int readlimit) throws IOException + { + in.mark(readlimit); + } -/* - * Instance Methods - */ + /*************************************************************************/ -/** - * Calls the in.mark(int) method. - * - * @param readlimit The parameter passed to in.mark(int) - * - * @exception IOException If an error occurs - */ -public void -mark(int readlimit) throws IOException -{ - in.mark(readlimit); -} + /** + * Calls the in.markSupported() method. + * + * @return true if mark/reset is supported, + * false otherwise + */ + public boolean markSupported() + { + return(in.markSupported()); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.markSupported() method. - * - * @return true if mark/reset is supported, false otherwise - */ -public boolean -markSupported() -{ - return(in.markSupported()); -} + /** + * Calls the in.reset() method. + * + * @exception IOException If an error occurs + */ + public void reset() throws IOException + { + in.reset(); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.reset() method. - * - * @exception IOException If an error occurs - */ -public void -reset() throws IOException -{ - in.reset(); -} + /** + * Calls the in.read() method. + * + * @return The value returned from in.available() + * + * @exception IOException If an error occurs + */ + public boolean ready() throws IOException + { + return(in.ready()); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.read() method. - * - * @return The value returned from in.available() - * - * @exception IOException If an error occurs - */ -public boolean -ready() throws IOException -{ - return(in.ready()); -} + /** + * Calls the in.skip(long) method + * + * @param numBytes The requested number of chars to skip. + * + * @return The value returned from in.skip(long) + * + * @exception IOException If an error occurs + */ + public long skip(long num_chars) throws IOException + { + return(in.skip(num_chars)); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.skip(long) method - * - * @param The requested number of chars to skip. - * - * @return The value returned from in.skip(long) - * - * @exception IOException If an error occurs - */ -public long -skip(long num_chars) throws IOException -{ - return(in.skip(num_chars)); -} + /** + * Calls the in.read() method + * + * @return The value returned from in.read() + * + * @exception IOException If an error occurs + */ + public int read() throws IOException + { + return(in.read()); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.read() method - * - * @return The value returned from in.read() - * - * @exception IOException If an error occurs - */ -public int -read() throws IOException -{ - return(in.read()); -} + /** + * Calls the in.read(char[], int, int) method. + * + * @param buf The buffer to read chars into + * @param offset The index into the buffer to start storing chars + * @param len The maximum number of chars to read. + * + * @return The value retured from in.read(char[], int, int) + * + * @exception IOException If an error occurs + */ + public int read(char[] buf, int offset, int len) throws IOException + { + return(in.read(buf, offset, len)); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * Calls the in.read(char[], int, int) method. - * - * @param buf The buffer to read chars into - * @param offset The index into the buffer to start storing chars - * @param len The maximum number of chars to read. - * - * @return The value retured from in.read(char[], int, int) - * - * @exception IOException If an error occurs - */ -public int -read(char[] buf, int offset, int len) throws IOException -{ - return(in.read(buf, offset, len)); -} - -/*************************************************************************/ - -/** - * This method closes the stream by calling the close() method - * of the underlying stream. - * - * @exception IOException If an error occurs - */ -public void -close() throws IOException -{ - in.close(); -} + /** + * This method closes the stream by calling the close() method + * of the underlying stream. + * + * @exception IOException If an error occurs + */ + public void close() throws IOException + { + in.close(); + } } // class FilterReader + diff --git a/libjava/java/io/FilterWriter.java b/libjava/java/io/FilterWriter.java index f94d9955a3d..f476dfee3f5 100644 --- a/libjava/java/io/FilterWriter.java +++ b/libjava/java/io/FilterWriter.java @@ -1,5 +1,5 @@ /* FilterWriter.java -- Parent class for output streams that filter - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -52,128 +52,120 @@ package java.io; * underlying stream. Subclasses provide actual filtering. * * @author Aaron M. Renn (arenn@urbanophile.com) - * @author Tom Tromey + * @author Tom Tromey */ public abstract class FilterWriter extends Writer { + /* + * Instance Variables + */ -/*************************************************************************/ + /** + * This is the subordinate Writer that this class + * redirects its method calls to. + */ + protected Writer out; -/* - * Instance Variables - */ + /*************************************************************************/ -/** - * This is the subordinate Writer that this class - * redirects its method calls to. - */ -protected Writer out; + /* + * Constructors + */ -/*************************************************************************/ + /** + * This method initializes an instance of FilterWriter + * to write to the specified subordinate Writer. + * The given Writer will be used as lock for + * the newly created FilterWriter. + * + * @param out The Writer to write to + */ + protected FilterWriter(Writer out) + { + super(out); + this.out = out; + } -/* - * Constructors - */ + /*************************************************************************/ -/** - * This method initializes an instance of FilterWriter - * to write to the specified subordinate Writer. - * The given Writer will be used as lock for - * the newly created FilterWriter. - * - * @param out The Writer to write to - */ -protected -FilterWriter(Writer out) -{ - super(out); - this.out = out; -} + /* + * Instance Methods + */ -/*************************************************************************/ + /** + * This method closes the underlying Writer. Any + * further attempts to write to this stream may throw an exception. + * + * @exception IOException If an error occurs + */ + public void close() throws IOException + { + out.close(); + } -/* - * Instance Methods - */ + /*************************************************************************/ -/** - * This method closes the underlying Writer. Any - * further attempts to write to this stream may throw an exception. - * - * @exception IOException If an error occurs - */ -public void -close() throws IOException -{ - out.close(); -} + /** + * This method attempt to flush all buffered output to be written to the + * underlying output sink. + * + * @exception IOException If an error occurs + */ + public void flush() throws IOException + { + out.flush(); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method attempt to flush all buffered output to be written to the - * underlying output sink. - * - * @exception IOException If an error occurs - */ -public void -flush() throws IOException -{ - out.flush(); -} + /** + * This method writes a single char of output to the underlying + * Writer. + * + * @param b The char to write, passed as an int. + * + * @exception IOException If an error occurs + */ + public void write(int b) throws IOException + { + out.write(b); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method writes a single char of output to the underlying - * Writer. - * - * @param b The char to write, passed as an int. - * - * @exception IOException If an error occurs - */ -public void -write(int b) throws IOException -{ - out.write(b); -} + /** + * This method writes len chars from the array buf + * starting at index offset to the underlying + * Writer. + * + * @param buf The char array to write chars from + * @param offset The index into the array to start writing chars from + * @param len The number of chars to write + * + * @exception IOException If an error occurs + */ + public void write(char[] buf, int offset, int len) throws IOException + { + out.write(buf, offset, len); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method writes len chars from the array buf - * starting at index offset to the underlying - * Writer. - * - * @param buf The char array to write chars from - * @param offset The index into the array to start writing chars from - * @param len The number of chars to write - * - * @exception IOException If an error occurs - */ -public void -write(char[] buf, int offset, int len) throws IOException -{ - out.write(buf, offset, len); -} - -/*************************************************************************/ - -/** - * This method writes len chars from the String - * starting at position offset. - * - * @param str The String that is to be written - * @param offset The character offset into the String to start writing from - * @param len The number of chars to write - * - * @exception IOException If an error occurs - */ -public void -write(String str, int offset, int len) throws IOException -{ - out.write(str, offset, len); -} + /** + * This method writes len chars from the String + * starting at position offset. + * + * @param str The String that is to be written + * @param offset The character offset into the String + * to start writing from + * @param len The number of chars to write + * + * @exception IOException If an error occurs + */ + public void write(String str, int offset, int len) throws IOException + { + out.write(str, offset, len); + } } // class FilterWriter diff --git a/libjava/java/io/ObjectInput.java b/libjava/java/io/ObjectInput.java index 4b10cf9c3ad..678a31edc48 100644 --- a/libjava/java/io/ObjectInput.java +++ b/libjava/java/io/ObjectInput.java @@ -1,5 +1,5 @@ /* ObjectInput.java -- Read object data from a stream - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998,2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,115 +44,108 @@ package java.io; * also has methods that allow input to be done in a manner similar to * InputStream * - * @version 0.0 - * * @author Aaron M. Renn (arenn@urbanophile.com) */ public interface ObjectInput extends DataInput { + /** + * This method returns the number of bytes that can be read without + * blocking. + * + * @return The number of bytes available before blocking + * + * @exception IOException If an error occurs + */ + public abstract int available() throws IOException; -/** - * This method returns the number of bytes that can be read without - * blocking. - * - * @return The number of bytes available before blocking - * - * @exception IOException If an error occurs - */ -public abstract int -available() throws IOException; + /*************************************************************************/ -/*************************************************************************/ + /** + * This method reading a byte of data from a stream. It returns that byte + * as an int. This method blocks if no data is available to be read. + * + * @return The byte of data read + * + * @exception IOException If an error occurs + */ + public abstract int read() throws IOException; -/** - * This method reading a byte of data from a stream. It returns that byte - * as an int. This method blocks if no data is available to be read. - * - * @return The byte of data read - * - * @exception IOException If an error occurs - */ -public abstract int -read() throws IOException; + /*************************************************************************/ -/*************************************************************************/ + /** + * This method reads raw bytes and stores them them a byte array buffer. + * Note that this method will block if no data is available. However, + * it will not necessarily block until it fills the entire buffer. That is, + * a "short count" is possible. + * + * @param buf The byte array to receive the data read + * + * @return The actual number fo bytes read or -1 if end of stream + * + * @exception IOException If an error occurs + */ + public abstract int read(byte[] buf) throws IOException; -/** - * This method reads raw bytes and stores them them a byte array buffer. - * Note that this method will block if no data is available. However, - * it will not necessarily block until it fills the entire buffer. That is, - * a "short count" is possible. - * - * @param buf The byte array to receive the data read - * - * @return The actual number fo bytes read or -1 if end of stream - * - * @exception IOException If an error occurs - */ -public abstract int -read(byte[] buf) throws IOException; + /*************************************************************************/ -/*************************************************************************/ + /** + * This method reads raw bytes and stores them in a byte array buffer + * buf starting at position offset into the + * buffer. A + * maximum of len bytes will be read. Note that this method + * blocks if no data is available, but will not necessarily block until + * it can read len bytes of data. That is, a "short count" is + * possible. + * + * @param buf The byte array to receive the data read + * @param offset The offset into @code{buf} to start storing data + * @param len The maximum number of bytes to read + * + * @return The actual number fo bytes read or -1 if end of stream + * + * @exception IOException If an error occurs + */ + public abstract int read(byte[] buf, int offset, int len) throws IOException; -/** - * This method reads raw bytes and stores them in a byte array buffer - * buf starting at position offset into the buffer. A - * maximum of len bytes will be read. Note that this method - * blocks if no data is available, but will not necessarily block until - * it can read len bytes of data. That is, a "short count" is - * possible. - * - * @param buf The byte array to receive the data read - * @param offset The offset into @code{buf} to start storing data - * @param len The maximum number of bytes to read - * - * @return The actual number fo bytes read or -1 if end of stream - * - * @exception IOException If an error occurs - */ -public abstract int -read(byte[] buf, int offset, int len) throws IOException; + /*************************************************************************/ -/*************************************************************************/ + /** + * Reads an object instance and returns it. If the class for the object + * being read cannot be found, then a ClassNotFoundException will + * be thrown. + * + * @return The object instance that was read + * + * @exception ClassNotFoundException If a class for the object cannot be + * found + * @exception IOException If an error occurs + */ + public abstract Object readObject() + throws ClassNotFoundException, IOException; -/** - * Reads an object instance and returns it. If the class for the object - * being read cannot be found, then a ClassNotFoundException will - * be thrown. - * - * @return The object instance that was read - * - * @exception ClassNotFoundException If a class for the object cannot be found - * @exception IOException If an error occurs - */ -public abstract Object -readObject() throws ClassNotFoundException, IOException; + /*************************************************************************/ -/*************************************************************************/ + /** + * This method causes the specified number of bytes to be read and + * discarded. It is possible that fewer than the requested number of bytes + * will actually be skipped. + * + * @param numBytes The number of bytes to skip + * + * @return The actual number of bytes skipped + * + * @exception IOException If an error occurs + */ + public abstract long skip(long num_bytes) throws IOException; -/** - * This method causes the specified number of bytes to be read and - * discarded. It is possible that fewer than the requested number of bytes - * will actually be skipped. - * - * @param num_bytes The number of bytes to skip - * - * @return The actual number of bytes skipped - * - * @exception IOException If an error occurs - */ -public abstract long -skip(long num_bytes) throws IOException; + /*************************************************************************/ -/*************************************************************************/ - -/** - * This method closes the input source - * - * @exception IOException If an error occurs - */ -public abstract void -close() throws IOException; + /** + * This method closes the input source + * + * @exception IOException If an error occurs + */ + public abstract void close() throws IOException; } // interface ObjectInput diff --git a/libjava/java/io/ObjectInputValidation.java b/libjava/java/io/ObjectInputValidation.java index 5433f123c3f..2259eb83285 100644 --- a/libjava/java/io/ObjectInputValidation.java +++ b/libjava/java/io/ObjectInputValidation.java @@ -1,5 +1,5 @@ /* ObjectInputValidation.java -- Validate an object - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -41,21 +41,18 @@ package java.io; /** * What does this interface really do? * - * @version 0.0 - * * @author Aaron M. Renn (arenn@urbanophile.com) */ public interface ObjectInputValidation { -/** - * This method is called to validate an object. If the object is invalid - * an exception is thrown. - * - * @exception InvalidObjectException If the object is invalid - */ -public abstract void -validateObject() throws InvalidObjectException; + /** + * This method is called to validate an object. If the object is invalid + * an exception is thrown. + * + * @exception InvalidObjectException If the object is invalid + */ + public abstract void validateObject() throws InvalidObjectException; } // interface ObjectInputValidation diff --git a/libjava/java/io/ObjectOutput.java b/libjava/java/io/ObjectOutput.java index 7da0640b6c4..1397027d402 100644 --- a/libjava/java/io/ObjectOutput.java +++ b/libjava/java/io/ObjectOutput.java @@ -1,5 +1,5 @@ /* ObjectOutput.java -- Interface for writing objects to a stream - Copyright (C) 1998 Free Software Foundation, Inc. + Copyright (C) 1998, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -41,87 +41,80 @@ package java.io; /** * This interface extends DataOutput to provide the additional * facility of writing object instances to a stream. It also adds some - * additional methods to make the interface more OutputStream like. - * - * @version 0.0 + * additional methods to make the interface more + * OutputStream like. * * @author Aaron M. Renn (arenn@urbanophile.com) */ public interface ObjectOutput extends DataOutput { + /** + * This method writes the specified byte to the output stream. + * + * @param b The byte to write. + * + * @exception IOException If an error occurs. + */ + public abstract void write(int b) throws IOException; -/** - * This method writes the specified byte to the output stream. - * - * @param b The byte to write. - * - * @exception IOException If an error occurs. - */ -public abstract void -write(int b) throws IOException; + /*************************************************************************/ -/*************************************************************************/ + /** + * This method writes all the bytes in the specified byte array to the + * output stream. + * + * @param buf The array of bytes to write. + * + * @exception IOException If an error occurs. + */ + public abstract void write(byte[] buf) throws IOException; -/** - * This method writes all the bytes in the specified byte array to the - * output stream. - * - * @param buf The array of bytes to write. - * - * @exception IOException If an error occurs. - */ -public abstract void -write(byte[] buf) throws IOException; + /*************************************************************************/ -/*************************************************************************/ + /** + * This method writes len bytes from the specified array + * starting at index offset into that array. + * + * @param buf The byte array to write from. + * @param offset The index into the byte array to start writing from. + * @param len The number of bytes to write. + * + * @exception IOException If an error occurs. + */ + public abstract void write(byte[] buf, int offset, int len) + throws IOException; -/** - * This method writes len bytes from the specified array - * starting at index offset into that array. - * - * @param buf The byte array to write from. - * @param offset The index into the byte array to start writing from. - * @param len The number of bytes to write. - * - * @exception IOException If an error occurs. - */ -public abstract void -write(byte[] buf, int offset, int len) throws IOException; + /*************************************************************************/ -/*************************************************************************/ + /** + * This method writes a object instance to a stream. The format of the + * data written is determined by the actual implementation of this method + * + * @param obj The object to write + * + * @exception IOException If an error occurs + */ + public abstract void writeObject(Object obj) throws IOException; -/** - * This method writes a object instance to a stream. The format of the - * data written is determined by the actual implementation of this method - * - * @param obj The object to write - * - * @exception IOException If an error occurs - */ -public abstract void -writeObject(Object obj) throws IOException; + /*************************************************************************/ -/*************************************************************************/ + /** + * This method causes any buffered data to be flushed out to the underlying + * stream + * + * @exception IOException If an error occurs + */ + public abstract void flush() throws IOException; -/** - * This method causes any buffered data to be flushed out to the underlying - * stream - * - * @exception IOException If an error occurs - */ -public abstract void -flush() throws IOException; + /*************************************************************************/ -/*************************************************************************/ - -/** - * This method closes the underlying stream. - * - * @exception IOException If an error occurs - */ -public abstract void -close() throws IOException; + /** + * This method closes the underlying stream. + * + * @exception IOException If an error occurs + */ + public abstract void close() throws IOException; } // interface ObjectOutput diff --git a/libjava/java/io/ObjectStreamField.java b/libjava/java/io/ObjectStreamField.java index bb78a786c1f..56f0d1aa872 100644 --- a/libjava/java/io/ObjectStreamField.java +++ b/libjava/java/io/ObjectStreamField.java @@ -1,5 +1,5 @@ /* ObjectStreamField.java -- Class used to store name and class of fields - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,17 +51,21 @@ public class ObjectStreamField implements java.lang.Comparable } /** - * There're many cases you can't get java.lang.Class from typename if your context + * There're many cases you can't get java.lang.Class from typename + * if your context * class loader can't load it, then use typename to construct the field */ ObjectStreamField (String name, String typename){ this.name = name; this.typename = typename; - try{ - type = TypeSignature.getClassForEncoding(typename); - }catch(ClassNotFoundException e){ - type = Object.class; //?? - } + try + { + type = TypeSignature.getClassForEncoding(typename); + } + catch(ClassNotFoundException e) + { + type = Object.class; //FIXME: ??? + } } public String getName () @@ -125,3 +129,4 @@ public class ObjectStreamField implements java.lang.Comparable private String typename; private int offset = -1; // XXX make sure this is correct } + diff --git a/libjava/java/io/PipedInputStream.java b/libjava/java/io/PipedInputStream.java index 4816ce6f79b..bf7730a85c4 100644 --- a/libjava/java/io/PipedInputStream.java +++ b/libjava/java/io/PipedInputStream.java @@ -1,5 +1,5 @@ /* PipedInputStream.java -- Read portion of piped streams. - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,7 +46,8 @@ package java.io; * to which it is connected. *

* Data is read and written to an internal buffer. It is highly recommended - * that the PipedInputStream and connected PipedOutputStream + * that the PipedInputStream and connected + * PipedOutputStream * be part of different threads. If they are not, the read and write * operations could deadlock their thread. * @@ -113,7 +114,8 @@ public class PipedInputStream extends InputStream * it to the passed in PipedOutputStream. The stream is then * ready for reading. * - * @param source The PipedOutputStream to connect this stream to + * @param source The PipedOutputStream to connect this + * stream to * * @exception IOException If source is already connected. */ @@ -123,7 +125,8 @@ public class PipedInputStream extends InputStream } /** - * This method connects this stream to the passed in PipedOutputStream. + * This method connects this stream to the passed in + * PipedOutputStream. * This stream is then ready for reading. If this stream is already * connected or has been previously closed, then an exception is thrown * @@ -224,9 +227,12 @@ public class PipedInputStream extends InputStream /** * This method reads bytes from the stream into a caller supplied buffer. - * It starts storing bytes at position offset into the buffer and - * reads a maximum of len bytes. Note that this method can actually - * read fewer than len bytes. The actual number of bytes read is + * It starts storing bytes at position offset into the + * buffer and + * reads a maximum of len bytes. Note that this method + * can actually + * read fewer than len bytes. The actual number of bytes + * read is * returned. A -1 is returned to indicated that no bytes can be read * because the end of the stream was reached. If the stream is already * closed, a -1 will again be returned to indicate the end of the stream. @@ -255,9 +261,12 @@ public class PipedInputStream extends InputStream /** * This method reads bytes from the stream into a caller supplied buffer. - * It starts storing bytes at position offset into the buffer and - * reads a maximum of len bytes. Note that this method can actually - * read fewer than len bytes. The actual number of bytes read is + * It starts storing bytes at position offset into the + * buffer and + * reads a maximum of len bytes. Note that this method + * can actually + * read fewer than len bytes. The actual number of bytes + * read is * returned. A -1 is returned to indicated that no bytes can be read * because the end of the stream was reached - ie close() was called on the * connected PipedOutputStream. @@ -371,3 +380,4 @@ public class PipedInputStream extends InputStream notifyAll(); } } + diff --git a/libjava/java/io/PipedReader.java b/libjava/java/io/PipedReader.java index 64233a8d350..ec135427d09 100644 --- a/libjava/java/io/PipedReader.java +++ b/libjava/java/io/PipedReader.java @@ -118,7 +118,8 @@ public class PipedReader extends Reader } /** - * This method connects this stream to the passed in PipedWriter. + * This method connects this stream to the passed in + * PipedWriter. * This stream is then ready for reading. If this stream is already * connected or has been previously closed, then an exception is thrown * @@ -207,9 +208,12 @@ public class PipedReader extends Reader /** * This method reads chars from the stream into a caller supplied buffer. - * It starts storing chars at position offset into the buffer and - * reads a maximum of len chars. Note that this method can actually - * read fewer than len chars. The actual number of chars read is + * It starts storing chars at position offset into the + * buffer and + * reads a maximum of len chars. Note that this method + * can actually + * read fewer than len chars. The actual number of chars + * read is * returned. A -1 is returned to indicated that no chars can be read * because the end of the stream was reached. If the stream is already * closed, a -1 will again be returned to indicate the end of the stream. @@ -237,10 +241,11 @@ public class PipedReader extends Reader } /** - * This method reads characters from the stream into a caller supplied buffer. - * It starts storing chars at position offset into the buffer and - * reads a maximum of len chars. Note that this method can actually - * read fewer than len chars. The actual number of chars read is + * This method reads characters from the stream into a caller supplied + * buffer. It starts storing chars at position offset into + * the buffer and reads a maximum of len chars. Note that + * this method can actually read fewer than len chars. + * The actual number of chars read is * returned. A -1 is returned to indicated that no chars can be read * because the end of the stream was reached - ie close() was called on the * connected PipedWriter. @@ -361,3 +366,4 @@ public class PipedReader extends Reader } } } + diff --git a/libjava/java/io/PrintWriter.java b/libjava/java/io/PrintWriter.java index 78a56dd0b41..acc6ae46e3d 100644 --- a/libjava/java/io/PrintWriter.java +++ b/libjava/java/io/PrintWriter.java @@ -48,8 +48,6 @@ package java.io; * class which also auto-flushes when it encounters a newline character * in the chars written). * - * @version 0.0 - * * @author Per Bothner * @author Aaron M. Renn (arenn@urbanophile.com) * @date April 17, 1998. @@ -99,7 +97,8 @@ public class PrintWriter extends Writer * every line is terminated or newline character is written. * * @param wr The Writer to write to. - * @param autoflush true to flush the stream after every line, false otherwise + * @param autoflush true to flush the stream after every + * line, false otherwise */ public PrintWriter(Writer wr, boolean autoflush) { @@ -130,7 +129,8 @@ public class PrintWriter extends Writer * constructor allows auto-flush functionality to be enabled if desired * * @param out The OutputStream to write to - * @param autoflush true to flush the stream after every println call, false otherwise. + * @param autoflush true to flush the stream after every + * println call, false otherwise. */ public PrintWriter(OutputStream out, boolean autoflush) { @@ -153,7 +153,8 @@ public class PrintWriter extends Writer * true forever for this stream. Before checking for an * error condition, this method flushes the stream. * - * @return true if an error has occurred, false otherwise + * @return true if an error has occurred, + * false otherwise */ public boolean checkError() { @@ -309,7 +310,7 @@ public class PrintWriter extends Writer * This is the system dependent line separator */ private static final char[] line_separator - = System.getProperty("line.separator").toCharArray(); + = System.getProperty("line.separator").toCharArray(); /** * This method prints a line separator sequence to the stream. The value @@ -567,3 +568,4 @@ public class PrintWriter extends Writer write(str, 0, str.length()); } } + diff --git a/libjava/java/io/PushbackReader.java b/libjava/java/io/PushbackReader.java index 80e949a170a..4a353190d81 100644 --- a/libjava/java/io/PushbackReader.java +++ b/libjava/java/io/PushbackReader.java @@ -1,5 +1,5 @@ /* PushbackReader.java -- An character stream that can unread chars - Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -48,8 +48,6 @@ package java.io; * The default pushback buffer size one char, but this can be overridden * by the creator of the stream. * - * @version 0.0 - * * @author Aaron M. Renn (arenn@urbanophile.com) * @author Warren Levy */ @@ -136,7 +134,8 @@ public class PushbackReader extends FilterReader * This method returns false to indicate that it does not support * mark/reset functionality. * - * @return This method returns false to indicate that this class does not support mark/reset functionality + * @return This method returns false to indicate that this + * class does not support mark/reset functionality * */ public boolean markSupported() @@ -165,7 +164,8 @@ public class PushbackReader extends FilterReader * read in the pushback buffer or if the underlying stream is ready to * be read. * - * @return true if this stream is ready to be read, false otherwise + * @return true if this stream is ready to be read, + * false otherwise * * @exception IOException If an error occurs */ @@ -252,7 +252,8 @@ public class PushbackReader extends FilterReader /** * This method read chars from a stream and stores them into a caller - * supplied buffer. It starts storing the data at index offset into + * supplied buffer. It starts storing the data at index offset + * into * the buffer and attempts to read len chars. This method can * return before reading the number of chars requested. The actual number * of chars read is returned as an int. A -1 is returned to indicate the @@ -302,8 +303,8 @@ public class PushbackReader extends FilterReader *

* If the pushback buffer is full, this method throws an exception. *

- * The argument to this method is an int. Only the low eight bits - * of this value are pushed back. + * The argument to this method is an int. Only the low eight + * bits of this value are pushed back. * * @param b The char to be pushed back, passed as an int * @@ -343,7 +344,8 @@ public class PushbackReader extends FilterReader /** * This method pushed back chars from the passed in array into the pushback - * buffer. The chars from buf[offset] to buf[offset + len] + * buffer. The chars from buf[offset] to + * buf[offset + len] * are pushed in reverse order so that the next char read from the stream * after this operation will be buf[offset] followed by * buf[offset + 1], etc. @@ -378,3 +380,4 @@ public class PushbackReader extends FilterReader } } } + diff --git a/libjava/java/io/Reader.java b/libjava/java/io/Reader.java index ffa3dbbd640..be8794928fd 100644 --- a/libjava/java/io/Reader.java +++ b/libjava/java/io/Reader.java @@ -1,5 +1,5 @@ /* Reader.java -- base class of classes that read input as a stream of chars - Copyright (C) 1998, 1999, 2000 Free Software Foundation + Copyright (C) 1998, 1999, 2000, 2003 Free Software Foundation This file is part of GNU Classpath. @@ -222,7 +222,8 @@ public abstract class Reader *

* This method always returns false in this class * - * @return true if the stream is ready to be read, false otherwise. + * @return true if the stream is ready to be read, + * false otherwise. * * @exception IOException If an error occurs */ diff --git a/libjava/java/io/SerializablePermission.java b/libjava/java/io/SerializablePermission.java index d9dc3dd924a..85b9cdf2445 100644 --- a/libjava/java/io/SerializablePermission.java +++ b/libjava/java/io/SerializablePermission.java @@ -1,5 +1,5 @@ /* SerializablePermission.java -- Basic permissions related to serialization. - Copyright (C) 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -55,64 +55,63 @@ import java.security.BasicPermission; * * @see java.security.BasicPermission * - * @version 0.0 - * * @author Aaron M. Renn (arenn@urbanophile.com) */ public final class SerializablePermission extends BasicPermission { static final long serialVersionUID = 8537212141160296410L; -/* - * Class Variables - */ + /* + * Class Variables + */ -private static final String[] legal_names = { "enableSubclassImplementation", - "enableSubstitution" }; -/*************************************************************************/ + private static final String[] legal_names = { "enableSubclassImplementation", + "enableSubstitution" }; + /*************************************************************************/ -/* - * Constructors - */ + /* + * Constructors + */ -/** - * This method initializes a new instance of SerializablePermission - * that has the specified name. - * - * @param name The name of the permission. - * - * @exception IllegalArgumentException If the name is not valid for this class. - */ -public -SerializablePermission(String name) -{ - this(name, null); -} + /** + * This method initializes a new instance of + * SerializablePermission + * that has the specified name. + * + * @param name The name of the permission. + * + * @exception IllegalArgumentException If the name is not valid for + * this class. + */ + public SerializablePermission(String name) + { + this(name, null); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method initializes a new instance of SerializablePermission - * that has the specified name and action list. Note that the action list - * is unused in this class. - * - * @param name The name of the permission. - * @param actions The action list (unused). - * - * @exception IllegalArgumentException If the name is not valid for this class. - */ -public -SerializablePermission(String name, String actions) -{ - super(name, actions); + /** + * This method initializes a new instance of + * SerializablePermission + * that has the specified name and action list. Note that the action list + * is unused in this class. + * + * @param name The name of the permission. + * @param actions The action list (unused). + * + * @exception IllegalArgumentException If the name is not valid for + * this class. + */ + public SerializablePermission(String name, String actions) + { + super(name, actions); - for (int i = 0; i < legal_names.length; i++) - if (legal_names[i].equals(name)) - return; - - throw new IllegalArgumentException("Bad permission name: " + name); -} + for (int i = 0; i < legal_names.length; i++) + if (legal_names[i].equals(name)) + return; + throw new IllegalArgumentException("Bad permission name: " + name); + } } // class SerializablePermission diff --git a/libjava/java/io/StringReader.java b/libjava/java/io/StringReader.java index 98a7c4b78e1..8153d80d91b 100644 --- a/libjava/java/io/StringReader.java +++ b/libjava/java/io/StringReader.java @@ -1,5 +1,5 @@ /* StringReader.java -- permits a String to be read as a character input stream - Copyright (C) 1998, 1999, 2000 Free Software Foundation + Copyright (C) 1998, 1999, 2000, 2003 Free Software Foundation This file is part of GNU Classpath. @@ -51,8 +51,6 @@ package java.io; * normal. If no mark has been set, then calling the reset() * method rewinds the read pointer to the beginning of the String. * - * @version 0.0 - * * @author Aaron M. Renn (arenn@urbanophile.com) * @author Warren Levy * @date October 19, 1998. @@ -73,8 +71,8 @@ public class StringReader extends Reader /** * Create a new StringReader that will read chars from the - * passed in String. This stream will read from the beginning to the - * end of the String. + * passed in String. This stream will read from the beginning + * to the end of the String. * * @param s The String this stream will read from. */ @@ -208,3 +206,4 @@ public class StringReader extends Reader } } } + diff --git a/libjava/java/io/Writer.java b/libjava/java/io/Writer.java index b86e9c8b538..3b2cf79ffdc 100644 --- a/libjava/java/io/Writer.java +++ b/libjava/java/io/Writer.java @@ -1,5 +1,5 @@ /* Writer.java -- Base class for character output streams - Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -55,168 +55,161 @@ package java.io; */ public abstract class Writer { + /** + * This is the object used to synchronize criticial code sections for + * thread safety. Subclasses should use this field instead of using + * synchronized methods or explicity synchronizations on this + */ + protected Object lock; -/*************************************************************************/ + /*************************************************************************/ -/** - * This is the object used to synchronize criticial code sections for - * thread safety. Subclasses should use this field instead of using - * synchronized methods or explicity synchronizations on this - */ -protected Object lock; + /* + * Constructors + */ -/*************************************************************************/ + /** + * This is the default no-argument constructor for this class. This method + * will set up the class to synchronize criticial sections on itself. + */ + protected Writer() + { + lock = this; + } -/* - * Constructors - */ + /*************************************************************************/ -/** - * This is the default no-argument constructor for this class. This method - * will set up the class to synchronize criticial sections on itself. - */ -protected -Writer() -{ - lock = this; -} + /** + * This method initializes a Writer that will synchronize + * on the specified Object. + * + * @param obj The Object to use for synchronizing critical + * sections + */ + protected Writer(Object lock) + { + this.lock = lock; + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method initializes a Writer that will synchronize - * on the specified Object. - * - * @param obj The Object to use for synchronizing critical - * sections - */ -protected -Writer(Object lock) -{ - this.lock = lock; -} + /* + * Instance Methods + */ -/*************************************************************************/ + /** + * This method forces any data that may have been buffered to be written + * to the underlying output device. Please note that the host environment + * might perform its own buffering unbeknowst to Java. In that case, a + * write made (for example, to a disk drive) might be cached in OS + * buffers instead of actually being written to disk. + * + * @exception IOException If an error occurs + */ + public abstract void flush() throws IOException; -/* - * Instance Methods - */ + /*************************************************************************/ -/** - * This method forces any data that may have been buffered to be written - * to the underlying output device. Please note that the host environment - * might perform its own buffering unbeknowst to Java. In that case, a - * write made (for example, to a disk drive) might be cached in OS - * buffers instead of actually being written to disk. - * - * @exception IOException If an error occurs - */ -public abstract void -flush() throws IOException; + /** + * This method closes the stream. Any internal or native resources + * associated + * with this stream are freed. Any subsequent attempt to access the stream + * might throw an exception. + *

+ * This method in this class does nothing. + * + * @exception IOException If an error occurs + */ + public abstract void close() throws IOException; -/*************************************************************************/ + /*************************************************************************/ -/** - * This method closes the stream. Any internal or native resources associated - * with this stream are freed. Any subsequent attempt to access the stream - * might throw an exception. - *

- * This method in this class does nothing. - * - * @exception IOException If an error occurs - */ -public abstract void -close() throws IOException; + /** + * This method writes a single char to the output stream. + * + * @param b The char to be written to the output stream, passed as an int + * + * @exception IOException If an error occurs + */ + public void write(int b) throws IOException + { + char[] buf = new char[1]; -/*************************************************************************/ + buf[0] = (char)b; + write(buf, 0, buf.length); + } -/** - * This method writes a single char to the output stream. - * - * @param b The char to be written to the output stream, passed as an int - * - * @exception IOException If an error occurs - */ -public void -write(int b) throws IOException -{ - char[] buf = new char[1]; + /*************************************************************************/ - buf[0] = (char)b; - write(buf, 0, buf.length); -} + /** + * This method all the writes char from the passed array to the output + * stream. This method is equivalent to + * write(buf, 0, buf.length) which + * is exactly how it is implemented in this class. + * + * @param buf The array of char to write + * + * @exception IOException If an error occurs + */ + public void write(char[] buf) throws IOException + { + write(buf, 0, buf.length); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method all the writes char from the passed array to the output stream. - * This method is equivalent to write(buf, 0, buf.length) which - * is exactly how it is implemented in this class. - * - * @param buf The array of char to write - * - * @exception IOException If an error occurs - */ -public void -write(char[] buf) throws IOException -{ - write(buf, 0, buf.length); -} + /** + * This method writes len char from the specified array + * buf starting at index offset into the array. + *

+ * Subclasses must provide an implementation of this abstract method. + * + * @param buf The array of char to write from + * @param offset The index into the array to start writing from + * @param len The number of char to write + * + * @exception IOException If an error occurs + */ + public abstract void write(char[] buf, int offset, int len) + throws IOException; -/*************************************************************************/ + /*************************************************************************/ -/** - * This method writes len char from the specified array - * buf starting at index offset into the array. - *

- * Subclasses must provide an implementation of this abstract method. - * - * @param buf The array of char to write from - * @param offset The index into the array to start writing from - * @param len The number of char to write - * - * @exception IOException If an error occurs - */ -public abstract void -write(char[] buf, int offset, int len) throws IOException; + /** + * This method writes all the characters in a String to the + * output. + * + * @param str The String whose chars are to be written. + * + * @param IOException If an error occurs + */ + public void write(String str) throws IOException + { + write(str, 0, str.length()); + } -/*************************************************************************/ + /*************************************************************************/ -/** - * This method writes all the characters in a String to the - * output. - * - * @param str The String whose chars are to be written. - * - * @param IOException If an error occurs - */ -public void -write(String str) throws IOException -{ - write(str, 0, str.length()); -} + /** + * This method writes len chars from the String + * starting at position offset. + * + * @param str The String that is to be written + * @param offset The character offset into the String to start + * writing from + * @param len The number of chars to write + * + * @exception IOException If an error occurs + */ + public void write(String str, int offset, int len) throws IOException + { + // FIXME - for libgcj re-write using native code to not require + // copied buffer. + char[] buf = new char[len]; -/*************************************************************************/ - -/** - * This method writes len chars from the String - * starting at position offset. - * - * @param str The String that is to be written - * @param offset The character offset into the String to start - * writing from - * @param len The number of chars to write - * - * @exception IOException If an error occurs - */ -public void -write(String str, int offset, int len) throws IOException -{ - // FIXME - for libgcj re-write using native code to not require copied buffer. - char[] buf = new char[len]; - - str.getChars(offset, offset + len, buf, 0); - write(buf, 0, len); -} + str.getChars(offset, offset + len, buf, 0); + write(buf, 0, len); + } } // class Writer +