1 // SocketImpl.java - Abstract socket implementation.
3 /* Copyright (C) 1999 Red Hat, Inc.
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
15 * @author Per Bothner <bothner@cygnus.com>
16 * @date January 6, 1999.
19 /** Written using on-line Java Platform 1.2 API Specification.
20 * Believed complete and correct.
23 public abstract class SocketImpl
implements SocketOptions
25 protected InetAddress address
;
27 protected FileDescriptor fd
;
29 protected int localport
;
37 protected abstract void create (boolean stream
) throws IOException
;
39 protected abstract void connect (String host
, int port
) throws IOException
;
41 protected abstract void connect (InetAddress host
, int port
)
44 protected abstract void bind (InetAddress host
, int port
) throws IOException
;
46 protected abstract void listen (int backlog
) throws IOException
;
48 protected abstract void accept (SocketImpl s
) throws IOException
;
50 protected abstract InputStream
getInputStream() throws IOException
;
52 protected abstract OutputStream
getOutputStream() throws IOException
;
54 protected abstract int available () throws IOException
;
56 protected abstract void close () throws IOException
;
58 protected FileDescriptor
getFileDescriptor () { return fd
; }
60 protected InetAddress
getInetAddress () { return address
; }
62 protected int getPort () { return port
; }
64 protected int getLocalPort () { return localport
; }
66 public abstract Object
getOption(int optID
) throws SocketException
;
68 public abstract void setOption(int optID
, Object value
)
69 throws SocketException
;
71 public String
toString ()
73 return "[addr=" + address
.toString() + ",port=" + Integer
.toString(port
) +
74 ",localport=" + Integer
.toString(localport
) + "]";