diff options
author | Ronald Veldema <rveldema@cs.vu.nl> | 2002-03-12 11:36:21 +0000 |
---|---|---|
committer | Ronald Veldema <rveldema@cs.vu.nl> | 2002-03-12 11:36:21 +0000 |
commit | 7ff7e6abd8b17e9d9c7551e8d76503fb18325daa (patch) | |
tree | 37faea2330a248899efb9d9613d88810dad0ac98 /java/nio/channels | |
parent | cc038371891900ee57b02542f26ecfa5b938f121 (diff) | |
download | classpath-7ff7e6abd8b17e9d9c7551e8d76503fb18325daa.tar.gz |
* Removes dependencies on manta; javax.swing,
gnu.java.nio and java.nio now compile with jikes;
Diffstat (limited to 'java/nio/channels')
-rw-r--r-- | java/nio/channels/AlreadyConnectedException.java | 2 | ||||
-rw-r--r-- | java/nio/channels/ClosedChannelException.java | 2 | ||||
-rw-r--r-- | java/nio/channels/DatagramChannel.java | 32 | ||||
-rw-r--r-- | java/nio/channels/FileLock.java | 17 | ||||
-rw-r--r-- | java/nio/channels/GatheringByteChannel.java | 2 | ||||
-rw-r--r-- | java/nio/channels/InterruptibleChannel.java | 1 | ||||
-rw-r--r-- | java/nio/channels/Pipe.java | 4 | ||||
-rw-r--r-- | java/nio/channels/ScatteringByteChannel.java | 2 | ||||
-rw-r--r-- | java/nio/channels/SelectableChannel.java | 18 | ||||
-rw-r--r-- | java/nio/channels/SelectionKey.java | 39 | ||||
-rw-r--r-- | java/nio/channels/Selector.java | 20 | ||||
-rw-r--r-- | java/nio/channels/ServerSocketChannel.java | 8 | ||||
-rw-r--r-- | java/nio/channels/SocketChannel.java | 20 | ||||
-rw-r--r-- | java/nio/channels/WritableByteChannel.java | 1 | ||||
-rw-r--r-- | java/nio/channels/spi/AbstractSelectableChannel.java | 18 | ||||
-rw-r--r-- | java/nio/channels/spi/AbstractSelectionKey.java | 4 | ||||
-rw-r--r-- | java/nio/channels/spi/AbstractSelector.java | 6 | ||||
-rw-r--r-- | java/nio/channels/spi/SelectorProvider.java | 14 |
18 files changed, 107 insertions, 103 deletions
diff --git a/java/nio/channels/AlreadyConnectedException.java b/java/nio/channels/AlreadyConnectedException.java index 72514b9d5..52766c9ea 100644 --- a/java/nio/channels/AlreadyConnectedException.java +++ b/java/nio/channels/AlreadyConnectedException.java @@ -5,7 +5,7 @@ import java.io.*; public class AlreadyConnectedException extends IOException { - AlreadyConnectedException() + public AlreadyConnectedException() { } } diff --git a/java/nio/channels/ClosedChannelException.java b/java/nio/channels/ClosedChannelException.java index 80bd30ce3..dcf0096c8 100644 --- a/java/nio/channels/ClosedChannelException.java +++ b/java/nio/channels/ClosedChannelException.java @@ -5,7 +5,7 @@ import java.io.*; public class ClosedChannelException extends IOException { - ClosedChannelException() + public ClosedChannelException() { } } diff --git a/java/nio/channels/DatagramChannel.java b/java/nio/channels/DatagramChannel.java index 2d1ec1a5c..43f94f8a4 100644 --- a/java/nio/channels/DatagramChannel.java +++ b/java/nio/channels/DatagramChannel.java @@ -15,12 +15,12 @@ public abstract class DatagramChannel { } -static DatagramChannel open() throws IOException + public static DatagramChannel open() throws IOException { return SelectorProvider.provider().openDatagramChannel(); } - - long read(ByteBuffer[] dsts) + + public long read(ByteBuffer[] dsts) { long b = 0; for (int i=0;i<dsts.length;i++) @@ -28,28 +28,28 @@ static DatagramChannel open() throws IOException return b; } - abstract DatagramChannel connect(SocketAddress remote); - abstract DatagramChannel disconnect(); - abstract boolean isConnected(); - abstract public int read(ByteBuffer dst); - abstract long read(ByteBuffer[] dsts, int offset, int length); - abstract SocketAddress receive(ByteBuffer dst); - abstract int send(ByteBuffer src, SocketAddress target); - abstract DatagramSocket socket(); - abstract public int write(ByteBuffer src); - abstract public long write(ByteBuffer[] srcs, int offset, int length); + public abstract DatagramChannel connect(SocketAddress remote); + public abstract DatagramChannel disconnect(); + public abstract boolean isConnected(); + public abstract int read(ByteBuffer dst); + public abstract long read(ByteBuffer[] dsts, int offset, int length); + public abstract SocketAddress receive(ByteBuffer dst); + public abstract int send(ByteBuffer src, SocketAddress target); + public abstract DatagramSocket socket(); + public abstract int write(ByteBuffer src); + public abstract long write(ByteBuffer[] srcs, int offset, int length); - int validOps() + public int validOps() { return SelectionKey.OP_READ | SelectionKey.OP_WRITE; } - public long write(ByteBuffer[] dsts) + public int write(ByteBuffer[] dsts) { long b = 0; for (int i=0;i<dsts.length;i++) b += write(dsts[i]); - return b; + return (int)b; } } diff --git a/java/nio/channels/FileLock.java b/java/nio/channels/FileLock.java index 54cc56bd4..f2dca2e8b 100644 --- a/java/nio/channels/FileLock.java +++ b/java/nio/channels/FileLock.java @@ -19,19 +19,21 @@ public abstract class FileLock this.shared = shared; } - abstract boolean isValid(); - abstract void release(); + public abstract boolean isValid(); + public abstract void release(); - FileChannel channel() + + public FileChannel channel() { return channel; } - boolean isShared() + + public boolean isShared() { return shared; } - boolean overlaps(long position, long size) + public boolean overlaps(long position, long size) { if (position > this.position+this.size) return false; @@ -41,12 +43,13 @@ public abstract class FileLock return true; } - long position() + + public long position() { return position; } - long size() + public long size() { return size; } diff --git a/java/nio/channels/GatheringByteChannel.java b/java/nio/channels/GatheringByteChannel.java index 4fc2949e4..a46e7bf14 100644 --- a/java/nio/channels/GatheringByteChannel.java +++ b/java/nio/channels/GatheringByteChannel.java @@ -6,6 +6,6 @@ import java.io.*; public interface GatheringByteChannel extends WritableByteChannel { - public int write(ByteBuffer[] srcs, int offset, int length) throws IOException; + public long write(ByteBuffer[] srcs, int offset, int length) throws IOException; public int write(ByteBuffer[] srcs) throws IOException; } diff --git a/java/nio/channels/InterruptibleChannel.java b/java/nio/channels/InterruptibleChannel.java index 3187b905d..fc059a0e4 100644 --- a/java/nio/channels/InterruptibleChannel.java +++ b/java/nio/channels/InterruptibleChannel.java @@ -1,5 +1,6 @@ package java.nio.channels; +import java.io.IOException; public interface InterruptibleChannel extends Channel { diff --git a/java/nio/channels/Pipe.java b/java/nio/channels/Pipe.java index 81ebe3637..034dd3310 100644 --- a/java/nio/channels/Pipe.java +++ b/java/nio/channels/Pipe.java @@ -32,6 +32,6 @@ public abstract class Pipe return null; } - abstract SinkChannel sink(); - abstract SourceChannel source(); + public abstract SinkChannel sink(); + public abstract SourceChannel source(); } diff --git a/java/nio/channels/ScatteringByteChannel.java b/java/nio/channels/ScatteringByteChannel.java index 16ad3f5d4..1f1a39a98 100644 --- a/java/nio/channels/ScatteringByteChannel.java +++ b/java/nio/channels/ScatteringByteChannel.java @@ -5,6 +5,6 @@ import java.io.*; public interface ScatteringByteChannel extends ReadableByteChannel { - public int write(ByteBuffer[] srcs, int offset, int length) throws IOException; + public long write(ByteBuffer[] srcs, int offset, int length) throws IOException; public int write(ByteBuffer[] srcs) throws IOException; } diff --git a/java/nio/channels/SelectableChannel.java b/java/nio/channels/SelectableChannel.java index 77763e5a4..58c86bee8 100644 --- a/java/nio/channels/SelectableChannel.java +++ b/java/nio/channels/SelectableChannel.java @@ -7,16 +7,16 @@ public abstract class SelectableChannel extends AbstractInterruptibleChannel protected SelectableChannel() { } - abstract Object blockingLock(); - abstract SelectableChannel configureBlocking(boolean block); - abstract boolean isBlocking(); - abstract boolean isRegistered(); - abstract SelectionKey keyFor(Selector sel); - abstract SelectorProvider provider(); - SelectionKey register(Selector sel, int ops) + public abstract Object blockingLock(); + public abstract SelectableChannel configureBlocking(boolean block); + public abstract boolean isBlocking(); + public abstract boolean isRegistered(); + public abstract SelectionKey keyFor(Selector sel); + public abstract SelectorProvider provider(); + public SelectionKey register(Selector sel, int ops) throws java.nio.channels.ClosedChannelException { return register(sel, ops, null); } - abstract SelectionKey register(Selector sel, int ops, Object att); - abstract int validOps(); + public abstract SelectionKey register(Selector sel, int ops, Object att) throws java.nio.channels.ClosedChannelException; + public abstract int validOps(); } diff --git a/java/nio/channels/SelectionKey.java b/java/nio/channels/SelectionKey.java index 4414be13b..a0dd91ab2 100644 --- a/java/nio/channels/SelectionKey.java +++ b/java/nio/channels/SelectionKey.java @@ -4,53 +4,52 @@ package java.nio.channels; public abstract class SelectionKey { - static int OP_ACCEPT = 1<<0; - static int OP_CONNECT = 1<<1; - static int OP_READ = 1<<2; - static int OP_WRITE = 1<<3; + public static int OP_ACCEPT = 1<<0; + public static int OP_CONNECT = 1<<1; + public static int OP_READ = 1<<2; + public static int OP_WRITE = 1<<3; Object attached; -protected SelectionKey() + protected SelectionKey() { } - Object attach(Object obj) + public Object attach(Object obj) { Object old = attached; attached = obj; return old; } - Object attachment() + public Object attachment() { return attached; - } - - boolean isAcceptable() + } + public boolean isAcceptable() { return (readyOps() & OP_ACCEPT) != 0; } - boolean isConnectable() + public boolean isConnectable() { return (readyOps() & OP_CONNECT) != 0; } - boolean isReadable() + public boolean isReadable() { return (readyOps() & OP_READ) != 0; } - boolean isWritable() + public boolean isWritable() { return (readyOps() & OP_WRITE) != 0; } - abstract void cancel(); - abstract SelectableChannel channel(); - abstract int interestOps(); - abstract SelectionKey interestOps(int ops); - abstract boolean isValid(); - abstract int readyOps(); - abstract Selector selector(); + public abstract void cancel(); + public abstract SelectableChannel channel(); + public abstract int interestOps(); + public abstract SelectionKey interestOps(int ops); + public abstract boolean isValid(); + public abstract int readyOps(); + public abstract Selector selector(); } diff --git a/java/nio/channels/Selector.java b/java/nio/channels/Selector.java index a4271ce91..a869d709a 100644 --- a/java/nio/channels/Selector.java +++ b/java/nio/channels/Selector.java @@ -14,14 +14,14 @@ public abstract class Selector return SelectorProvider.provider().openSelector(); } - abstract void close(); - abstract boolean isOpen(); - abstract Set keys(); - abstract SelectorProvider provider(); - abstract int select(); - abstract int select(long timeout); - abstract Set selectedKeys(); - abstract Set cancelledKeys(); - abstract int selectNow(); - abstract Selector wakeup(); + public abstract void close(); + public abstract boolean isOpen(); + public abstract Set keys(); + public abstract SelectorProvider provider(); + public abstract int select(); + public abstract int select(long timeout); + public abstract Set selectedKeys(); + public abstract Set cancelledKeys(); + public abstract int selectNow(); + public abstract Selector wakeup(); } diff --git a/java/nio/channels/ServerSocketChannel.java b/java/nio/channels/ServerSocketChannel.java index d27ee1587..5626c74d1 100644 --- a/java/nio/channels/ServerSocketChannel.java +++ b/java/nio/channels/ServerSocketChannel.java @@ -13,15 +13,15 @@ public abstract class ServerSocketChannel } - abstract SocketChannel accept(); - abstract ServerSocket socket(); + public abstract SocketChannel accept(); + public abstract ServerSocket socket(); - static ServerSocketChannel open() throws IOException + public static ServerSocketChannel open() throws IOException { return SelectorProvider.provider().openServerSocketChannel(); } - int validOps() + public int validOps() { return SelectionKey.OP_ACCEPT; } diff --git a/java/nio/channels/SocketChannel.java b/java/nio/channels/SocketChannel.java index 77e03f2d7..a1c2a4539 100644 --- a/java/nio/channels/SocketChannel.java +++ b/java/nio/channels/SocketChannel.java @@ -49,19 +49,19 @@ abstract public class SocketChannel extends AbstractSelectableChannel return b; } - int validOps() + public int validOps() { return SelectionKey.OP_CONNECT | SelectionKey.OP_READ | SelectionKey.OP_WRITE; } - abstract int read(ByteBuffer dst); - abstract boolean connect(SocketAddress remote); - abstract boolean finishConnect(); - abstract boolean isConnected(); - abstract boolean isConnectionPending(); - abstract long read(ByteBuffer[] dsts, int offset, int length); - abstract Socket socket(); - abstract int write(ByteBuffer src); - abstract long write(ByteBuffer[] srcs, int offset, int length); + public abstract int read(ByteBuffer dst); + public abstract boolean connect(SocketAddress remote) throws IOException; + public abstract boolean finishConnect(); + public abstract boolean isConnected(); + public abstract boolean isConnectionPending(); + public abstract long read(ByteBuffer[] dsts, int offset, int length); + public abstract Socket socket(); + public abstract int write(ByteBuffer src); + public abstract long write(ByteBuffer[] srcs, int offset, int length); } diff --git a/java/nio/channels/WritableByteChannel.java b/java/nio/channels/WritableByteChannel.java index 9b72cf58e..2366dc9fb 100644 --- a/java/nio/channels/WritableByteChannel.java +++ b/java/nio/channels/WritableByteChannel.java @@ -1,5 +1,6 @@ package java.nio.channels; + import java.io.*; import java.nio.*; diff --git a/java/nio/channels/spi/AbstractSelectableChannel.java b/java/nio/channels/spi/AbstractSelectableChannel.java index 222737b7d..be93a78ad 100644 --- a/java/nio/channels/spi/AbstractSelectableChannel.java +++ b/java/nio/channels/spi/AbstractSelectableChannel.java @@ -17,13 +17,13 @@ public abstract class AbstractSelectableChannel extends SelectableChannel protected abstract void implConfigureBlocking(boolean block); - Object blockingLock() + public Object blockingLock() { return LOCK; //Retrieves the object upon which the configureBlocking and register methods synchronize. } - SelectableChannel configureBlocking(boolean block) + public SelectableChannel configureBlocking(boolean block) { synchronized(LOCK) { @@ -34,21 +34,21 @@ public abstract class AbstractSelectableChannel extends SelectableChannel return this; } -protected void implCloseChannel() + protected void implCloseChannel() { // Closes this channel. implCloseSelectableChannel(); } -boolean isBlocking() + public boolean isBlocking() { return blocking; //Tells whether or not every I/O operation on this channel will block until it completes. } -boolean isRegistered() + public boolean isRegistered() { //Tells whether or not this channel is currently registered with any selectors. return registered > 0; @@ -64,7 +64,7 @@ boolean isRegistered() } } - SelectorProvider provider() + public SelectorProvider provider() { // Returns the provider that created this channel. return sprovider; @@ -95,9 +95,9 @@ boolean isRegistered() keys.add(k); } - SelectionKey register(Selector selin, - int ops, - Object att) throws ClosedChannelException + public SelectionKey register(Selector selin, + int ops, + Object att) throws java.nio.channels.ClosedChannelException { diff --git a/java/nio/channels/spi/AbstractSelectionKey.java b/java/nio/channels/spi/AbstractSelectionKey.java index 7b3b1bc0a..38c4f7e19 100644 --- a/java/nio/channels/spi/AbstractSelectionKey.java +++ b/java/nio/channels/spi/AbstractSelectionKey.java @@ -13,7 +13,7 @@ public abstract class AbstractSelectionKey { } - void cancel() + public void cancel() { if (ok) { @@ -22,7 +22,7 @@ public abstract class AbstractSelectionKey ok = false; } - boolean isValid() + public boolean isValid() { return ok; } diff --git a/java/nio/channels/spi/AbstractSelector.java b/java/nio/channels/spi/AbstractSelector.java index 7223ed2e2..0d1a9b41c 100644 --- a/java/nio/channels/spi/AbstractSelector.java +++ b/java/nio/channels/spi/AbstractSelector.java @@ -19,7 +19,7 @@ public abstract class AbstractSelector extends Selector { } - void close() + public void close() { if (closed) return; @@ -41,8 +41,8 @@ public abstract class AbstractSelector extends Selector { return ! closed; } - - SelectorProvider provider() + + public SelectorProvider provider() { return provider; } diff --git a/java/nio/channels/spi/SelectorProvider.java b/java/nio/channels/spi/SelectorProvider.java index c83a1cffc..f35857d8f 100644 --- a/java/nio/channels/spi/SelectorProvider.java +++ b/java/nio/channels/spi/SelectorProvider.java @@ -9,20 +9,20 @@ public abstract class SelectorProvider { } - abstract DatagramChannel openDatagramChannel(); - abstract Pipe openPipe(); - abstract AbstractSelector openSelector(); - abstract ServerSocketChannel openServerSocketChannel(); - abstract SocketChannel openSocketChannel(); + public abstract DatagramChannel openDatagramChannel(); + public abstract Pipe openPipe(); + public abstract AbstractSelector openSelector(); + public abstract ServerSocketChannel openServerSocketChannel(); + public abstract SocketChannel openSocketChannel(); static SelectorProvider pr; - static SelectorProvider provider() + public static SelectorProvider provider() { if (pr == null) { - pr = new manta.runtime.SelectorProviderImpl(); + pr = new gnu.java.nio.SelectorProviderImpl(); } return pr; } |