Index: java/io/FileDescriptor.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/io/FileDescriptor.java,v
retrieving revision 1.18
diff -u -b -B -r1.18 FileDescriptor.java
--- java/io/FileDescriptor.java 15 May 2003 13:12:02 -0000 1.18
+++ java/io/FileDescriptor.java 23 Jan 2004 14:09:02 -0000
@@ -1,5 +1,6 @@
/* FileDescriptor.java -- Opaque file handle class
- Copyright (C) 1998,2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -46,6 +47,8 @@
* type. No system specific information can be obtained from this object.
*
* @author Aaron M. Renn (address@hidden)
+ * @author Tom Tromey (address@hidden)
+ * @date September 24, 1998
*/
public final class FileDescriptor
{
@@ -54,33 +57,33 @@
* stream. This will usually be accessed through the
* System.in
variable.
*/
- public static final FileDescriptor in = new FileDescriptor ();
+ public static final FileDescriptor in = new FileDescriptor();
/**
* A FileDescriptor
representing the system standard output
* stream. This will usually be accessed through the
* System.out
variable.
*/
- public static final FileDescriptor out = new FileDescriptor ();
+ public static final FileDescriptor out = new FileDescriptor();
/**
* A FileDescriptor
representing the system standard error
* stream. This will usually be accessed through the
* System.err
variable.
*/
- public static final FileDescriptor err = new FileDescriptor ();
+ public static final FileDescriptor err = new FileDescriptor();
static
{
if (Configuration.INIT_LOAD_LIBRARY)
{
- System.loadLibrary ("javaio");
+ System.loadLibrary("javaio");
}
nativeInit();
}
- // Use for seeking
+ // These are WHENCE values for seek.
static final int SET = 0;
static final int CUR = 1;
static final int END = 2;
@@ -143,7 +147,7 @@
public boolean valid()
{
if (nativeFd == -1L)
- return(false);
+ return false;
return nativeValid(nativeFd);
}
@@ -211,7 +215,7 @@
if (nativeFd == -1L)
throw new IOException("Invalid FileDescriptor");
- return(nativeReadByte(nativeFd));
+ return nativeReadByte(nativeFd);
}
int read(byte[] buf, int offset, int len) throws IOException
@@ -230,7 +234,7 @@
// Note that above ops implicitly bomb if buf == null
- return(nativeReadBuf(nativeFd, buf, offset, len));
+ return nativeReadBuf(nativeFd, buf, offset, len);
}
int available() throws IOException
@@ -238,7 +242,7 @@
if (nativeFd == -1L)
throw new IOException("Invalid FileDescriptor");
- return(nativeAvailable(nativeFd));
+ return nativeAvailable(nativeFd);
}
long seek(long offset, int whence, boolean stopAtEof) throws IOException
@@ -249,7 +253,7 @@
if ((whence != SET) && (whence != CUR) && (whence != END))
throw new IllegalArgumentException("Invalid whence value: " + whence);
- return(nativeSeek(nativeFd, offset, whence, stopAtEof));
+ return nativeSeek(nativeFd, offset, whence, stopAtEof);
}
long getFilePointer() throws IOException
@@ -257,7 +261,7 @@
if (nativeFd == -1L)
throw new IOException("Invalid FileDescriptor");
- return(nativeGetFilePointer(nativeFd));
+ return nativeGetFilePointer(nativeFd);
}
long getLength() throws IOException
@@ -265,7 +269,7 @@
if (nativeFd == -1L)
throw new IOException("Invalid FileDescriptor");
- return(nativeGetLength(nativeFd));
+ return nativeGetLength(nativeFd);
}
void setLength(long len) throws IOException
@@ -283,7 +287,7 @@
// Don't do anything crazy with this
long getNativeFd()
{
- return(nativeFd);
+ return nativeFd;
}
private void setNativeFd(long nativeFd)
@@ -324,7 +328,7 @@
* @param path Name of the file to open
* @param mode Mode to open
*
- * @returns The resulting file descriptor for the opened file, or -1
+ * @return The resulting file descriptor for the opened file, or -1
* on failure (exception also signaled).
*
* @exception IOException If an error occurs.
@@ -337,7 +341,7 @@
*
* @param fd The native file descriptor to close
*
- * @returns The return code of the native close command.
+ * @return The return code of the native close command.
*
* @exception IOException If an error occurs
*/
@@ -354,7 +358,6 @@
* @exception IOException If an error occurs
*/
private native long nativeWriteByte(long fd, int b) throws IOException;
- // I hate name mangling.
/**
* Writes a byte buffer to the file
@@ -370,7 +373,6 @@
*/
private native long nativeWriteBuf(long fd, byte[] buf, int offset, int len)
throws IOException;
- // I hate name mangling.
/**
* Reads a single byte from the file
@@ -383,7 +385,6 @@
* @exception IOException If an error occurs
*/
private native int nativeReadByte(long fd) throws IOException;
- // I hate name mangling.
/**
* Reads a buffer of bytes from the file
@@ -399,7 +400,6 @@
*/
private native int nativeReadBuf(long fd, byte[] buf, int offset, int len)
throws IOException;
- // I hate name mangling.
/**
* Returns the number of bytes available for reading
@@ -439,7 +439,6 @@
* @exception IOException If an error occurs
*/
private native long nativeGetFilePointer(long fd) throws IOException;
- // Really could implement in terms of seek
/**
* Returns the length of the file in bytes
@@ -481,5 +480,4 @@
* @exception IOException If an error occurs
*/
private native void nativeSync(long fd) throws SyncFailedException;
-
-} // class FileDescriptor
+}