2003-03-20 16:19:58 +08:00
|
|
|
/* PlainSocketImpl.java -- Default socket implementation
|
|
|
|
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
1999-04-07 22:42:40 +08:00
|
|
|
|
2003-03-20 16:19:58 +08:00
|
|
|
This file is part of GNU Classpath.
|
1999-04-07 22:42:40 +08:00
|
|
|
|
2003-03-20 16:19:58 +08:00
|
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA.
|
|
|
|
|
|
|
|
Linking this library statically or dynamically with other modules is
|
|
|
|
making a combined work based on this library. Thus, the terms and
|
|
|
|
conditions of the GNU General Public License cover the whole
|
|
|
|
combination.
|
|
|
|
|
|
|
|
As a special exception, the copyright holders of this library give you
|
|
|
|
permission to link this library with independent modules to produce an
|
|
|
|
executable, regardless of the license terms of these independent
|
|
|
|
modules, and to copy and distribute the resulting executable under
|
|
|
|
terms of your choice, provided that you also meet, for each linked
|
|
|
|
independent module, the terms and conditions of the license of that
|
|
|
|
module. An independent module is a module which is not derived from
|
|
|
|
or based on this library. If you modify this library, you may extend
|
|
|
|
this exception to your version of the library, but you are not
|
|
|
|
obligated to do so. If you do not wish to do so, delete this
|
|
|
|
exception statement from your version. */
|
1999-04-07 22:42:40 +08:00
|
|
|
|
|
|
|
|
|
|
|
package java.net;
|
|
|
|
|
2002-11-18 22:55:54 +08:00
|
|
|
import java.io.InputStream;
|
2002-11-18 21:22:55 +08:00
|
|
|
import java.io.IOException;
|
2002-11-18 22:55:54 +08:00
|
|
|
import java.io.OutputStream;
|
2003-06-21 21:24:13 +08:00
|
|
|
import gnu.classpath.Configuration;
|
1999-05-12 09:51:23 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Written using on-line Java Platform 1.2 API Specification, as well
|
|
|
|
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
|
|
|
* Status: Believed complete and correct.
|
2003-06-21 21:24:13 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2003-06-21 22:02:10 +08:00
|
|
|
* Unless the application installs its own SocketImplFactory, this is the
|
|
|
|
* default socket implemetation that will be used. It simply uses a
|
|
|
|
* combination of Java and native routines to implement standard BSD
|
|
|
|
* style sockets of family AF_INET and types SOCK_STREAM and SOCK_DGRAM
|
|
|
|
*
|
2002-01-09 05:14:58 +08:00
|
|
|
* @author Per Bothner <bothner@cygnus.com>
|
|
|
|
* @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
|
2003-06-21 22:02:10 +08:00
|
|
|
* @author Aaron M. Renn <arenn@urbanophile.com>
|
1999-05-12 09:51:23 +08:00
|
|
|
*/
|
1999-04-07 22:42:40 +08:00
|
|
|
class PlainSocketImpl extends SocketImpl
|
|
|
|
{
|
2003-06-21 21:24:13 +08:00
|
|
|
// Static initializer to load native library.
|
|
|
|
static
|
|
|
|
{
|
|
|
|
if (Configuration.INIT_LOAD_LIBRARY)
|
|
|
|
{
|
|
|
|
System.loadLibrary("javanet");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-05-27 01:00:06 +08:00
|
|
|
// These fields are mirrored for use in native code to avoid cpp conflicts
|
|
|
|
// when the #defines in system header files are the same as the public fields.
|
|
|
|
static final int _Jv_TCP_NODELAY_ = SocketOptions.TCP_NODELAY,
|
|
|
|
_Jv_SO_BINDADDR_ = SocketOptions.SO_BINDADDR,
|
|
|
|
_Jv_SO_REUSEADDR_ = SocketOptions.SO_REUSEADDR,
|
2002-09-04 Michael Koch <konqueror@gmx.de>
* java/net/DatagramSocket.java
(DatagramSocket): Added documentation.
(close): Likewise.
(getLocalAddress): Likewise.
(getLocalPort): Likewise.
(receive): Likewise.
(send): Likewise.
(setSoTimeout): Likewise.
(connect): New method.
(disconnect): New method.
(getInetAddress): New method (FIXME)
(getPort): New method.
(setReuseAddress): New method.
(getReuseAddress): New method.
(setBroadcast): New method.
(getBroadcast): New method.
(setTrafficClass): New method.
(getTrafficClass): New method.
* java/net/MulticastSocket.java):
(getTTL): Added @see in documentation.
(setTTL): Added @see in documentation.
(setLoopbackMode): New method.
(getLoopbackMode): New method.
* java/net/PlainSocketImpl.java:
Added new constants for the options SO_BROADCAST, SO_OOBINLINE,
IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
* java/net/PlainDatagramSocketImpl.java
Added new constants for the options SO_BROADCAST, SO_OOBINLINE,
IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
* java/net/natPlainSocketImpl.cc
(getOption): Implemented the options SO_BROADCAST, SO_OOBINLINE,
IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
(setOption): Implemented the options SO_BROADCAST, SO_OOBINLINE,
IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
This should also fix SO_KEEPALIVE
* java/net/natPlainDatagramSocketImpl.cc
(getOption): Implemented the options SO_BROADCAST, SO_OOBINLINE,
IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
(setOption): Implemented the options SO_BROADCAST, SO_OOBINLINE,
IP_MULTICAST_IF2, IP_MULTICAST_LOOP, IP_TOS
From-SVN: r56801
2002-09-05 01:35:22 +08:00
|
|
|
_Jv_SO_BROADCAST_ = SocketOptions.SO_BROADCAST,
|
|
|
|
_Jv_SO_OOBINLINE_ = SocketOptions.SO_OOBINLINE,
|
|
|
|
_Jv_IP_MULTICAST_IF_ = SocketOptions.IP_MULTICAST_IF,
|
|
|
|
_Jv_IP_MULTICAST_IF2_ = SocketOptions.IP_MULTICAST_IF2,
|
|
|
|
_Jv_IP_MULTICAST_LOOP_ = SocketOptions.IP_MULTICAST_LOOP,
|
|
|
|
_Jv_IP_TOS_ = SocketOptions.IP_TOS,
|
1999-05-27 01:00:06 +08:00
|
|
|
_Jv_SO_LINGER_ = SocketOptions.SO_LINGER,
|
|
|
|
_Jv_SO_TIMEOUT_ = SocketOptions.SO_TIMEOUT,
|
|
|
|
_Jv_SO_SNDBUF_ = SocketOptions.SO_SNDBUF,
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-31 02:16:00 +08:00
|
|
|
_Jv_SO_RCVBUF_ = SocketOptions.SO_RCVBUF,
|
|
|
|
_Jv_SO_KEEPALIVE_ = SocketOptions.SO_KEEPALIVE;
|
1999-05-27 01:00:06 +08:00
|
|
|
|
2002-01-09 05:14:58 +08:00
|
|
|
/**
|
|
|
|
* The OS file handle representing the socket.
|
|
|
|
* This is used for reads and writes to/from the socket and
|
|
|
|
* to close it.
|
|
|
|
*
|
|
|
|
* When the socket is closed this is reset to -1.
|
|
|
|
*/
|
1999-04-07 22:42:40 +08:00
|
|
|
int fnum = -1;
|
|
|
|
|
1999-05-29 03:29:53 +08:00
|
|
|
// This value is set/read by setOption/getOption.
|
|
|
|
int timeout = 0;
|
1999-06-17 08:21:26 +08:00
|
|
|
|
|
|
|
// localAddress cache
|
|
|
|
InetAddress localAddress;
|
1999-05-29 03:29:53 +08:00
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* A cached copy of the in stream for reading from the socket.
|
|
|
|
*/
|
|
|
|
private InputStream in;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A cached copy of the out stream for writing to the socket.
|
|
|
|
*/
|
|
|
|
private OutputStream out;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default do nothing constructor
|
|
|
|
*/
|
|
|
|
public PlainSocketImpl()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void finalize() throws Throwable
|
|
|
|
{
|
|
|
|
synchronized (this)
|
|
|
|
{
|
|
|
|
if (fnum != -1)
|
|
|
|
try
|
|
|
|
{
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
catch (IOException ex)
|
|
|
|
{
|
|
|
|
// ignore
|
|
|
|
}
|
|
|
|
}
|
|
|
|
super.finalize();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the specified option on a socket to the passed in object. For
|
|
|
|
* options that take an integer argument, the passed in object is an
|
|
|
|
* Integer. The option_id parameter is one of the defined constants in
|
|
|
|
* this interface.
|
|
|
|
*
|
|
|
|
* @param option_id The identifier of the option
|
|
|
|
* @param val The value to set the option to
|
|
|
|
*
|
|
|
|
* @exception SocketException If an error occurs
|
|
|
|
*/
|
1999-05-27 01:00:06 +08:00
|
|
|
public native void setOption(int optID, Object value) throws SocketException;
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Returns the current setting of the specified option. The Object returned
|
|
|
|
* will be an Integer for options that have integer values. The option_id
|
|
|
|
* is one of the defined constants in this interface.
|
|
|
|
*
|
|
|
|
* @param option_id The option identifier
|
|
|
|
*
|
|
|
|
* @return The current value of the option
|
|
|
|
*
|
|
|
|
* @exception SocketException If an error occurs
|
|
|
|
*/
|
1999-05-27 01:00:06 +08:00
|
|
|
public native Object getOption(int optID) throws SocketException;
|
|
|
|
|
JarURLConnection.java (getCertificates): New method from Classpath.
* java/net/JarURLConnection.java (getCertificates): New method
from Classpath.
* java/net/URLClassLoader.java (URLClassLoader): Extends
SecureClassLoader.
(definePackage): New method from Classpath.
(getPermissions): Likewise.
(newInstance): Likewise.
(findClass): Construct CodeSource for new class (from Classpath).
* java/net/SocketImpl.java (shutdownInput, shutdownOutput): New
methods.
* java/net/URL.java (getUserInfo): New method.
(set(String,String,int,String,String,String,String,String)): New
method.
* java/net/PlainSocketImpl.java (_Jv_SO_KEEPALIVE_): Define.
(shutdownInput, shutdownOutput): Declare.
* java/net/PlainDatagramSocketImpl.java (_Jv_SO_KEEPALIVE_):
Define.
* java/net/natPlainSocketImpl.cc (setOption): Handle keepalive.
(getOption): Likewise.
(shutdownInput): New method.
(shutdownOutput): Likewise.
* java/net/natPlainDatagramSocketImpl.cc (setOption): Handle
keepalive.
(getOption): Likewise.
* java/net/SocketOptions.java (SO_KEEPALIVE): New constant.
* java/net/Socket.java (setKeepAlive): New method.
(getKeepAlive): Likewise.
(shutdownInput, shutdownOutput): New methods.
From-SVN: r56685
2002-08-31 02:16:00 +08:00
|
|
|
public native void shutdownInput () throws IOException;
|
|
|
|
|
|
|
|
public native void shutdownOutput () throws IOException;
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Creates a new socket that is not bound to any local address/port and
|
|
|
|
* is not connected to any remote address/port. This will be created as
|
|
|
|
* a stream socket if the stream parameter is true, or a datagram socket
|
|
|
|
* if the stream parameter is false.
|
|
|
|
*
|
|
|
|
* @param stream true for a stream socket, false for a datagram socket
|
|
|
|
*/
|
1999-04-07 22:42:40 +08:00
|
|
|
protected native void create (boolean stream) throws IOException;
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Connects to the remote hostname and port specified as arguments.
|
|
|
|
*
|
|
|
|
* @param hostname The remote hostname to connect to
|
|
|
|
* @param port The remote port to connect to
|
|
|
|
*
|
|
|
|
* @exception IOException If an error occurs
|
|
|
|
*/
|
1999-04-07 22:42:40 +08:00
|
|
|
protected void connect (String host, int port) throws IOException
|
|
|
|
{
|
2002-09-11 02:02:02 +08:00
|
|
|
connect (new InetSocketAddress (InetAddress.getByName(host), port), 0);
|
1999-04-07 22:42:40 +08:00
|
|
|
}
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Connects to the remote address and port specified as arguments.
|
|
|
|
*
|
|
|
|
* @param addr The remote address to connect to
|
|
|
|
* @param port The remote port to connect to
|
|
|
|
*
|
|
|
|
* @exception IOException If an error occurs
|
|
|
|
*/
|
2002-09-11 02:02:02 +08:00
|
|
|
protected void connect (InetAddress host, int port) throws IOException
|
|
|
|
{
|
|
|
|
connect (new InetSocketAddress (host, port), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected native void connect (SocketAddress addr, int timeout)
|
1999-04-07 22:42:40 +08:00
|
|
|
throws IOException;
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Binds to the specified port on the specified addr. Note that this addr
|
|
|
|
* must represent a local IP address. **** How bind to INADDR_ANY? ****
|
|
|
|
*
|
|
|
|
* @param addr The address to bind to
|
|
|
|
* @param port The port number to bind to
|
|
|
|
*
|
|
|
|
* @exception IOException If an error occurs
|
|
|
|
*/
|
1999-04-07 22:42:40 +08:00
|
|
|
protected native void bind (InetAddress host, int port) throws IOException;
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Starts listening for connections on a socket. The queuelen parameter
|
|
|
|
* is how many pending connections will queue up waiting to be serviced
|
|
|
|
* before being accept'ed. If the queue of pending requests exceeds this
|
|
|
|
* number, additional connections will be refused.
|
|
|
|
*
|
|
|
|
* @param queuelen The length of the pending connection queue
|
|
|
|
*
|
|
|
|
* @exception IOException If an error occurs
|
|
|
|
*/
|
1999-04-07 22:42:40 +08:00
|
|
|
protected native void listen (int backlog) throws IOException;
|
|
|
|
|
|
|
|
private native void accept (PlainSocketImpl s) throws IOException;
|
2002-01-09 05:14:58 +08:00
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Accepts a new connection on this socket and returns in in the
|
|
|
|
* passed in SocketImpl.
|
|
|
|
*
|
|
|
|
* @param impl The SocketImpl object to accept this connection.
|
|
|
|
*/
|
1999-04-07 22:42:40 +08:00
|
|
|
protected void accept (SocketImpl s) throws IOException
|
|
|
|
{
|
|
|
|
accept((PlainSocketImpl) s);
|
|
|
|
}
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Returns the number of bytes that the caller can read from this socket
|
|
|
|
* without blocking.
|
|
|
|
*
|
|
|
|
* @return The number of readable bytes before blocking
|
|
|
|
*
|
|
|
|
* @exception IOException If an error occurs
|
|
|
|
*/
|
2002-01-09 05:14:58 +08:00
|
|
|
protected native int available() throws IOException;
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Closes the socket. This will cause any InputStream or OutputStream
|
|
|
|
* objects for this Socket to be closed as well.
|
|
|
|
* <p>
|
|
|
|
* Note that if the SO_LINGER option is set on this socket, then the
|
|
|
|
* operation could block.
|
|
|
|
*
|
|
|
|
* @exception IOException If an error occurs
|
|
|
|
*/
|
2002-01-09 05:14:58 +08:00
|
|
|
protected native void close () throws IOException;
|
|
|
|
|
2002-09-11 02:02:02 +08:00
|
|
|
protected native void sendUrgentData(int data)
|
|
|
|
throws IOException;
|
2002-01-09 05:14:58 +08:00
|
|
|
|
2003-06-21 21:24:13 +08:00
|
|
|
native int read() throws IOException;
|
2002-01-09 05:14:58 +08:00
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2003-06-21 21:24:13 +08:00
|
|
|
native int read(byte[] buffer, int offset, int count)
|
2002-01-09 05:14:58 +08:00
|
|
|
throws IOException;
|
|
|
|
|
2003-06-21 21:24:13 +08:00
|
|
|
native void write(int c) throws IOException;
|
2002-01-09 05:14:58 +08:00
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2003-06-21 21:24:13 +08:00
|
|
|
native void write(byte[] buffer, int offset, int count)
|
2002-01-09 05:14:58 +08:00
|
|
|
throws IOException;
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Returns an InputStream object for reading from this socket. This will
|
|
|
|
* be an instance of SocketInputStream.
|
|
|
|
*
|
|
|
|
* @return An input stream attached to the socket.
|
|
|
|
*
|
|
|
|
* @exception IOException If an error occurs
|
2002-01-09 05:14:58 +08:00
|
|
|
*/
|
2003-06-21 22:02:10 +08:00
|
|
|
protected synchronized InputStream getInputStream() throws IOException
|
1999-04-07 22:42:40 +08:00
|
|
|
{
|
|
|
|
if (in == null)
|
2002-01-09 05:14:58 +08:00
|
|
|
in = new SocketInputStream();
|
2003-06-21 22:02:10 +08:00
|
|
|
|
1999-04-07 22:42:40 +08:00
|
|
|
return in;
|
|
|
|
}
|
|
|
|
|
2003-06-21 22:02:10 +08:00
|
|
|
/**
|
|
|
|
* Returns an OutputStream object for writing to this socket. This will
|
|
|
|
* be an instance of SocketOutputStream.
|
|
|
|
*
|
|
|
|
* @return An output stream attached to the socket.
|
|
|
|
*
|
|
|
|
* @exception IOException If an error occurs
|
2002-01-09 05:14:58 +08:00
|
|
|
*/
|
2003-06-21 22:02:10 +08:00
|
|
|
protected synchronized OutputStream getOutputStream() throws IOException
|
1999-04-07 22:42:40 +08:00
|
|
|
{
|
|
|
|
if (out == null)
|
2002-01-09 05:14:58 +08:00
|
|
|
out = new SocketOutputStream();
|
2003-06-21 22:02:10 +08:00
|
|
|
|
1999-04-07 22:42:40 +08:00
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|
2002-01-09 05:14:58 +08:00
|
|
|
/**
|
|
|
|
* A stream which reads from the socket implementation.
|
|
|
|
*
|
|
|
|
* @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
|
|
|
|
*/
|
|
|
|
class SocketInputStream
|
|
|
|
extends InputStream
|
1999-04-07 22:42:40 +08:00
|
|
|
{
|
2002-01-09 05:14:58 +08:00
|
|
|
SocketInputStream()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void close() throws IOException
|
|
|
|
{
|
|
|
|
PlainSocketImpl.this.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int available() throws IOException
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
1999-04-07 22:42:40 +08:00
|
|
|
}
|
|
|
|
|
2002-01-09 05:14:58 +08:00
|
|
|
/** A stream which writes to the socket implementation.
|
|
|
|
*
|
|
|
|
* @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
|
|
|
|
*/
|
|
|
|
class SocketOutputStream
|
|
|
|
extends OutputStream
|
1999-04-07 22:42:40 +08:00
|
|
|
{
|
2002-01-09 05:14:58 +08:00
|
|
|
public final void close() throws IOException
|
|
|
|
{
|
|
|
|
PlainSocketImpl.this.close();
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void write(int c) throws IOException
|
|
|
|
{
|
|
|
|
PlainSocketImpl.this.write(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void write(byte[] buffer, int offset, int length)
|
|
|
|
throws IOException
|
|
|
|
{
|
|
|
|
PlainSocketImpl.this.write(buffer, offset, length);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void write(byte[] buffer)
|
|
|
|
throws IOException
|
|
|
|
{
|
|
|
|
PlainSocketImpl.this.write(buffer, 0, buffer.length);
|
|
|
|
}
|
1999-04-07 22:42:40 +08:00
|
|
|
}
|
|
|
|
}
|