* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59307
138bc75d-0d04-0410-961f-
82ee72b054a4
+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.
-/* Copyright (C) 1998, 1999, 2001 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation
This file is part of libgcj.
package java.io;
+import java.nio.channels.FileChannel;
+
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date October 28, 1998.
/* 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();
long endPos = fd.seek(n, FileDescriptor.CUR, true);
return endPos - startPos;
}
+
+ public FileChannel getChannel ()
+ {
+ return ch;
+ }
}
package java.io;
+import java.nio.channels.FileChannel;
+
/**
* @author Tom Tromey <tromey@cygnus.com>
* @date September 24, 1998
// Instance variables.
private FileDescriptor fd;
+
+ public FileChannel getChannel ()
+ {
+ return null;
+ }
}
throws IOException
{
this();
+
if (impl == null)
throw new IOException("Cannot initialize Socket implementation");
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);
}
/**
/**
* Tells whether or not this key is valid.
- *
- * @exception CancelledKeyException If this key has been cancelled
*/
public abstract boolean isValid ();
}
/**
- * 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 ();
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
{
{
synchronized (LOCK)
{
- blocking = true;
- implConfigureBlocking (block);
+ blocking = true;
+ implConfigureBlocking (block);
}
return this;
/**
* Closes this channel.
+ *
+ * @exception IOException If an error occurs
*/
protected final void implCloseChannel ()
{
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
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;