OSDN Git Service

* All files: Updated copyright information.
[pf3gnuchains/gcc-fork.git] / libjava / java / net / SocketImpl.java
1 // SocketImpl.java - Abstract socket implementation.
2
3 /* Copyright (C) 1999  Free Software Foundation
4
5    This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10
11 package java.net;
12 import java.io.*;
13
14 /**
15   * @author Per Bothner <bothner@cygnus.com>
16   * @date January 6, 1999.
17   */
18
19 /** Written using on-line Java Platform 1.2 API Specification.
20   * Believed complete and correct.
21   */
22
23 public abstract class SocketImpl implements SocketOptions
24 {
25   protected InetAddress address;
26
27   protected FileDescriptor fd;
28
29   protected int localport;
30
31   protected int port;
32
33   public SocketImpl ()
34   {
35   }
36
37   protected abstract void create (boolean stream) throws IOException;
38
39   protected abstract void connect (String host, int port) throws IOException;
40
41   protected abstract void connect (InetAddress host, int port)
42     throws IOException;
43
44   protected abstract void bind (InetAddress host, int port) throws IOException;
45
46   protected abstract void listen (int backlog) throws IOException;
47
48   protected abstract void accept (SocketImpl s) throws IOException;
49
50   protected abstract InputStream getInputStream() throws IOException;
51
52   protected abstract OutputStream getOutputStream() throws IOException;
53
54   protected abstract int available () throws IOException;
55
56   protected abstract void close () throws IOException;
57
58   protected FileDescriptor getFileDescriptor () { return fd; }
59
60   protected InetAddress getInetAddress () { return address; }
61
62   protected int getPort () { return port; }
63
64   protected int getLocalPort () { return localport; }
65
66   public abstract Object getOption(int optID) throws SocketException;
67
68   public abstract void setOption(int optID, Object value)
69     throws SocketException;
70
71   public String toString ()
72   {
73     return "[addr=" + address.toString() + ",port=" + Integer.toString(port) +
74       ",localport=" + Integer.toString(localport) + "]";
75   }
76 }