aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2002-11-20 16:19:08 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2002-11-20 16:19:08 +0000
commit3ebb998e6fd4db2150c4c60f0977b2b4ca3d39fa (patch)
tree79f607cf0830a31df050e0c63c02b22944c84a26 /libjava
parente6226a2f87a75d3daf21896affc0857a94d5d4ac (diff)
downloadgcc-3ebb998e6fd4db2150c4c60f0977b2b4ca3d39fa.zip
gcc-3ebb998e6fd4db2150c4c60f0977b2b4ca3d39fa.tar.gz
gcc-3ebb998e6fd4db2150c4c60f0977b2b4ca3d39fa.tar.bz2
2002-11-20 Michael Koch <konqueror@gmx.de>
* java/io/FileInputStream.java (getChannel): New method. * java/io/FileOutputStream.java (getChannel): New method. * java/net/ServerSocket.java (bind): Removed duplicate code and called another bind method instead. * java/nio/channels/SelectionKey.java (isValid): Removed wrong exception documentation. * java/nio/channels/ServerSocketChannel.java (accept): Added exception documentation. (open): Fixed typo, added exception documentation. * java/nio/channels/spi/AbstractSelectableChannel.java (implCloseChannel): Added exception documentation. (add): Reformated. (register): Added exception documentation. From-SVN: r59307
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog18
-rw-r--r--libjava/java/io/FileInputStream.java11
-rw-r--r--libjava/java/io/FileOutputStream.java7
-rw-r--r--libjava/java/net/ServerSocket.java15
-rw-r--r--libjava/java/nio/channels/SelectionKey.java2
-rw-r--r--libjava/java/nio/channels/ServerSocketChannel.java17
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelectableChannel.java20
7 files changed, 65 insertions, 25 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 656013d..5d978a5 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,21 @@
+2002-11-20 Michael Koch <konqueror@gmx.de>
+
+ * java/io/FileInputStream.java
+ (getChannel): New method.
+ * java/io/FileOutputStream.java
+ (getChannel): New method.
+ * java/net/ServerSocket.java
+ (bind): Removed duplicate code and called another bind method instead.
+ * java/nio/channels/SelectionKey.java
+ (isValid): Removed wrong exception documentation.
+ * java/nio/channels/ServerSocketChannel.java
+ (accept): Added exception documentation.
+ (open): Fixed typo, added exception documentation.
+ * java/nio/channels/spi/AbstractSelectableChannel.java
+ (implCloseChannel): Added exception documentation.
+ (add): Reformated.
+ (register): Added exception documentation.
+
2002-11-20 Andreas Jaeger <aj@suse.de>
* configure: Regenerated with new libtool.m4.
diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java
index 6a02d2b..d7efc26 100644
--- a/libjava/java/io/FileInputStream.java
+++ b/libjava/java/io/FileInputStream.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation
This file is part of libgcj.
@@ -8,6 +8,8 @@ details. */
package java.io;
+import java.nio.channels.FileChannel;
+
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date October 28, 1998.
@@ -23,6 +25,8 @@ public class FileInputStream extends InputStream
/* Contains the file descriptor for referencing the actual file. */
private FileDescriptor fd;
+ private FileChannel ch;
+
public FileInputStream(String name) throws FileNotFoundException
{
SecurityManager s = System.getSecurityManager();
@@ -92,4 +96,9 @@ public class FileInputStream extends InputStream
long endPos = fd.seek(n, FileDescriptor.CUR, true);
return endPos - startPos;
}
+
+ public FileChannel getChannel ()
+ {
+ return ch;
+ }
}
diff --git a/libjava/java/io/FileOutputStream.java b/libjava/java/io/FileOutputStream.java
index b592299..5ea24e5 100644
--- a/libjava/java/io/FileOutputStream.java
+++ b/libjava/java/io/FileOutputStream.java
@@ -10,6 +10,8 @@ details. */
package java.io;
+import java.nio.channels.FileChannel;
+
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
@@ -93,4 +95,9 @@ public class FileOutputStream extends OutputStream
// Instance variables.
private FileDescriptor fd;
+
+ public FileChannel getChannel ()
+ {
+ return null;
+ }
}
diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java
index dda834e..62917b6 100644
--- a/libjava/java/net/ServerSocket.java
+++ b/libjava/java/net/ServerSocket.java
@@ -151,6 +151,7 @@ public class ServerSocket
throws IOException
{
this();
+
if (impl == null)
throw new IOException("Cannot initialize Socket implementation");
@@ -181,19 +182,7 @@ public class ServerSocket
public void bind (SocketAddress endpoint)
throws IOException
{
- if (impl == null)
- throw new IOException ("Cannot initialize Socket implementation");
-
- if (! (endpoint instanceof InetSocketAddress))
- throw new IllegalArgumentException ("Address type not supported");
-
- InetSocketAddress tmp = (InetSocketAddress) endpoint;
-
- SecurityManager s = System.getSecurityManager ();
- if (s != null)
- s.checkListen (tmp.getPort ());
-
- impl.bind (tmp.getAddress (), tmp.getPort ());
+ bind (endpoint, 50);
}
/**
diff --git a/libjava/java/nio/channels/SelectionKey.java b/libjava/java/nio/channels/SelectionKey.java
index 361be18..8d06a30 100644
--- a/libjava/java/nio/channels/SelectionKey.java
+++ b/libjava/java/nio/channels/SelectionKey.java
@@ -147,8 +147,6 @@ public abstract class SelectionKey
/**
* Tells whether or not this key is valid.
- *
- * @exception CancelledKeyException If this key has been cancelled
*/
public abstract boolean isValid ();
diff --git a/libjava/java/nio/channels/ServerSocketChannel.java b/libjava/java/nio/channels/ServerSocketChannel.java
index ed8d392..16a3a82 100644
--- a/libjava/java/nio/channels/ServerSocketChannel.java
+++ b/libjava/java/nio/channels/ServerSocketChannel.java
@@ -60,7 +60,18 @@ public abstract class ServerSocketChannel
}
/**
- * Accepts a connection made to this channel's socket.
+ * Accepts a connection made to this channel's socket.
+ *
+ * @exception IOException If an error occurs
+ * @exception AsynchronousCloseException If another thread closes this
+ * channel while the accept operation is in progress.
+ * @exception ClosedByInterruptException If another thread interrupts the
+ * current thread while the accept operation is in progress, thereby closing
+ * the channel and setting the current thread's interrupt status.
+ * @exception ClosedChannelException If the channel is closed.
+ * @exception NotYetBoundException If the channel's socket is not yet bound.
+ * @exception SecurityException If a security manager has been installed and
+ * it does not permit access to the remote endpoint of the new connection.
*/
public abstract SocketChannel accept ();
@@ -70,7 +81,9 @@ public abstract class ServerSocketChannel
public abstract ServerSocket socket ();
/**
- * Opens a server socker channel.
+ * Opens a server socket channel.
+ *
+ * @exception IOException If an error occurs
*/
public static ServerSocketChannel open () throws IOException
{
diff --git a/libjava/java/nio/channels/spi/AbstractSelectableChannel.java b/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
index 433b729..da03693 100644
--- a/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
+++ b/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
@@ -78,8 +78,8 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
{
synchronized (LOCK)
{
- blocking = true;
- implConfigureBlocking (block);
+ blocking = true;
+ implConfigureBlocking (block);
}
return this;
@@ -87,6 +87,8 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
/**
* Closes this channel.
+ *
+ * @exception IOException If an error occurs
*/
protected final void implCloseChannel ()
{
@@ -168,13 +170,17 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
private void add (SelectionKey key)
{
if (keys == null)
- keys = new LinkedList ();
+ {
+ keys = new LinkedList ();
+ }
keys.add (key);
}
/**
* Registers this channel with the given selector, returning a selection key.
+ *
+ * @exception ClosedChannelException If the channel is already closed.
*/
public final SelectionKey register (Selector selin, int ops, Object att)
throws ClosedChannelException
@@ -187,19 +193,19 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
synchronized (LOCK)
{
- k = locate (selector);
+ k = locate (selector);
- if (k != null)
+ if (k != null)
{
k.attach (att);
}
- else
+ else
{
k = selector.register (this, ops, att);
if (k != null)
add (k);
- }
+ }
}
return k;