aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/SocketImpl.java
blob: d902a30e40aac8f3a19e3b6a5a6b2aa6b87e5ee6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// SocketImpl.java - Abstract socket implementation.

/* Copyright (C) 1999  Free Software Foundation

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

package java.net;
import java.io.*;

/**
  * @author Per Bothner <bothner@cygnus.com>
  * @date January 6, 1999.
  */

/** Written using on-line Java Platform 1.2 API Specification.
  * Believed complete and correct.
  */

public abstract class SocketImpl implements SocketOptions
{
  protected InetAddress address;

  protected FileDescriptor fd;

  protected int localport;

  protected int port;

  public SocketImpl ()
  {
  }

  protected abstract void create (boolean stream) throws IOException;

  protected abstract void connect (String host, int port) throws IOException;

  protected abstract void connect (InetAddress host, int port)
    throws IOException;

  protected abstract void bind (InetAddress host, int port) throws IOException;

  protected abstract void listen (int backlog) throws IOException;

  protected abstract void accept (SocketImpl s) throws IOException;

  protected abstract InputStream getInputStream() throws IOException;

  protected abstract OutputStream getOutputStream() throws IOException;

  protected abstract int available () throws IOException;

  protected abstract void close () throws IOException;

  protected FileDescriptor getFileDescriptor () { return fd; }

  protected InetAddress getInetAddress () { return address; }

  protected int getPort () { return port; }

  protected int getLocalPort () { return localport; }

  public abstract Object getOption(int optID) throws SocketException;

  public abstract void setOption(int optID, Object value)
    throws SocketException;

  public String toString ()
  {
    return "[addr=" + address.toString() + ",port=" + Integer.toString(port) +
      ",localport=" + Integer.toString(localport) + "]";
  }
}