From 9b7fe786e1287f830952706fbd9ddb39077d70a9 Mon Sep 17 00:00:00 2001 From: Bryce McKinlay Date: Wed, 24 Sep 2003 05:38:36 +0000 Subject: PlainSocketImpl.java (read): Remove declaration. * gnu/java/net/PlainSocketImpl.java (read): Remove declaration. (write): Likewise. (SocketInputStream, SocketOutputStream): Declare `read' and `write' native. Remove implementations which called back into PlainSocketImpl. Remove unneccessary overridden methods. * gnu/java/net/natPlainSocketImplNoNet.cc (read): Move implementation to inner class PlainSocketImpl.SocketInputStream. (write): Likewise. * gnu/java/net/natPlainSocketImplPosix.cc: As above. * gnu/java/net/natPlainSocketImplWin32.cc: As above. * gnu/java/net/SocketInputStream.java: Remove unused file. * gnu/java/net/SocketOutputStream.java: Likewise. * Makefile.am: Build CNI headers for PlainSocketImpl.SocketInputStream and SocketOutputStream. * Makefile.in: Rebuilt. From-SVN: r71724 --- libjava/gnu/java/net/PlainSocketImpl.java | 78 +++++-------------------------- 1 file changed, 12 insertions(+), 66 deletions(-) (limited to 'libjava/gnu/java/net/PlainSocketImpl.java') diff --git a/libjava/gnu/java/net/PlainSocketImpl.java b/libjava/gnu/java/net/PlainSocketImpl.java index 182f357f55f..3edb9745bed 100644 --- a/libjava/gnu/java/net/PlainSocketImpl.java +++ b/libjava/gnu/java/net/PlainSocketImpl.java @@ -271,32 +271,6 @@ public final class PlainSocketImpl extends SocketImpl protected native void sendUrgentData(int data) throws IOException; - native int read() throws IOException; - - /** - * Internal method used by SocketInputStream for reading data from - * the connection. Reads up to len bytes of data into the buffer - * buf starting at offset bytes into the buffer. - * - * @return The actual number of bytes read or -1 if end of stream. - * - * @exception IOException If an error occurs - */ - native int read(byte[] buffer, int offset, int count) - throws IOException; - - native void write(int c) throws IOException; - - /** - * Internal method used by SocketOuputStream for writing data to - * the connection. Writes up to len bytes of data from the buffer - * buf starting at offset bytes into the buffer. - * - * @exception IOException If an error occurs - */ - native void write(byte[] buffer, int offset, int count) - throws IOException; - /** * Returns an InputStream object for reading from this socket. This will * be an instance of SocketInputStream. @@ -334,13 +308,14 @@ public final class PlainSocketImpl extends SocketImpl * * @author Nic Ferrier */ - class SocketInputStream + final class SocketInputStream extends InputStream { - SocketInputStream() - { - } - + public native int read() throws IOException; + + public native int read(byte[] buffer, int offset, int length) + throws IOException; + public final void close() throws IOException { PlainSocketImpl.this.close(); @@ -350,52 +325,23 @@ public final class PlainSocketImpl extends SocketImpl { return PlainSocketImpl.this.available(); } - - public final int read() throws IOException - { - return PlainSocketImpl.this.read(); - } - - public final int read(byte[] buffer, int offset, int length) - throws IOException - { - return PlainSocketImpl.this.read(buffer, offset, length); - } - - public final int read(byte[] buffer) - throws IOException - { - return PlainSocketImpl.this.read(buffer, 0, buffer.length); - } } /** A stream which writes to the socket implementation. * * @author Nic Ferrier */ - class SocketOutputStream + final class SocketOutputStream extends OutputStream { - public final void close() throws IOException - { - PlainSocketImpl.this.close(); - } + public native void write(int c) throws IOException; - public final void write(int c) throws IOException - { - PlainSocketImpl.this.write(c); - } + public native void write(byte[] buffer, int offset, int length) + throws IOException; - public final void write(byte[] buffer, int offset, int length) - throws IOException + public void close() throws IOException { - PlainSocketImpl.this.write(buffer, offset, length); - } - - public final void write(byte[] buffer) - throws IOException - { - PlainSocketImpl.this.write(buffer, 0, buffer.length); + PlainSocketImpl.this.close(); } } } -- cgit v1.2.3