diff options
| author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-14 06:37:59 +0000 |
|---|---|---|
| committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-14 06:37:59 +0000 |
| commit | 87a1da8d641b8769b808ab2e806027e237261a23 (patch) | |
| tree | 24fccf7ef3db6564bf6419c09974cfbc9fba0c84 /libjava/gnu/java/nio/SocketChannelImpl.java | |
| parent | 979e2687de7fcb92a1b39364206d02cda2f1dd25 (diff) | |
| download | gcc-87a1da8d641b8769b808ab2e806027e237261a23.tar.gz | |
2003-05-14 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileLockImpl.java
(released): New member variable.
(FileLockImpl): Initialize released.
(releaseImpl): New native method.
(release): Implemented.
* gnu/java/nio/SelectorImpl.java: Reformatted.
* gnu/java/nio/SelectionKeyImpl.java: Reformatted.
* gnu/java/nio/ServerSocketChannelImpl.java: Reformatted.
(accept): Throws IOException.
* gnu/java/nio/SocketChannelImpl.java: Reformatted.
(implConfigureBlocking): Throws IOException.
(connect): Likewise.
(read): Likewise.
(write): Likewise.
* gnu/java/nio/natFileLockImpl.cc: New file.
* java/nio/channels/FileLock.java: Reformatted.
* Makefile.am:
(ordinary_java_source_files): Added gnu/java/nio/FileLockImpl.java.
(nat_source_files): Added gnu/java/nio/natFileLockImpl.cc.
* Makefile.in: Regenerated.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66799 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/java/nio/SocketChannelImpl.java')
| -rw-r--r-- | libjava/gnu/java/nio/SocketChannelImpl.java | 60 |
1 files changed, 31 insertions, 29 deletions
diff --git a/libjava/gnu/java/nio/SocketChannelImpl.java b/libjava/gnu/java/nio/SocketChannelImpl.java index 9f2de278d81..65ca62341ae 100644 --- a/libjava/gnu/java/nio/SocketChannelImpl.java +++ b/libjava/gnu/java/nio/SocketChannelImpl.java @@ -80,37 +80,36 @@ public class SocketChannelImpl extends SocketChannel public void finalizer() { if (connected) - { + { try { - close(); + close (); } catch (Exception e) { } - } + } } - protected void implCloseSelectableChannel() + protected void implCloseSelectableChannel () throws IOException { connected = false; SocketClose(fd); fd = SocketCreate(); } - protected void implConfigureBlocking(boolean block) + protected void implConfigureBlocking (boolean blocking) throws IOException { - if (blocking == block) - return; + if (this.blocking == blocking) + return; } - public boolean connect(SocketAddress remote) - throws IOException + public boolean connect (SocketAddress remote) throws IOException { if (connected) - { - throw new AlreadyConnectedException(); - } + { + throw new AlreadyConnectedException (); + } // ok, lets connect ! @@ -130,17 +129,17 @@ public class SocketChannelImpl extends SocketChannel return blocking; } - public boolean finishConnect() + public boolean finishConnect () { return false; } - public boolean isConnected() + public boolean isConnected () { return connected; } - public boolean isConnectionPending() + public boolean isConnectionPending () { if (blocking) return true; @@ -148,7 +147,7 @@ public class SocketChannelImpl extends SocketChannel return false; } - public Socket socket() + public Socket socket () { if (sock_object != null) { @@ -158,7 +157,7 @@ public class SocketChannelImpl extends SocketChannel return sock_object; } - public int read(ByteBuffer dst) + public int read (ByteBuffer dst) throws IOException { int bytes = 0; int len = 1024; @@ -168,27 +167,29 @@ public class SocketChannelImpl extends SocketChannel dst.put(b, 0, bytes); if (bytes == 0) - { + { // we've hit eof ? return -1; - } + } return bytes; } - public long read(ByteBuffer[] dsts, int offset, int length) + public long read (ByteBuffer[] dsts, int offset, int length) + throws IOException { long bytes = 0; - for (int i=offset; i<length; i++) - { - bytes += read(dsts[i]); - } + for (int i = offset; i < length; i++) + { + bytes += read (dsts [i]); + } return bytes; } - public int write(ByteBuffer src) + public int write (ByteBuffer src) + throws IOException { int bytes = 0; int len = src.position(); @@ -210,13 +211,14 @@ public class SocketChannelImpl extends SocketChannel } public long write (ByteBuffer[] srcs, int offset, int length) + throws IOException { long bytes = 0; - for (int i=offset; i<length; i++) - { - bytes += write(srcs[i]); - } + for (int i = offset; i < length; i++) + { + bytes += write (srcs [i]); + } return bytes; } |
