KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > alt > java > net > SocketImpl


1 package alt.java.net;
2
3 import java.net.InetAddress;
4 import java.net.SocketException;
5 import java.io.IOException;
6 import java.io.InputStream;
7 import java.io.OutputStream;
8
9 public class SocketImpl implements Socket {
10     private final java.net.Socket socket;
11
12     public SocketImpl(java.net.Socket socket) {
13         this.socket = socket;
14     }
15
16     public InetAddress getInetAddress() {
17         return socket.getInetAddress();
18     }
19
20     public InetAddress getLocalAddress() {
21         return socket.getLocalAddress();
22     }
23
24     public int getPort() {
25         return socket.getPort();
26     }
27
28     public int getLocalPort() {
29         return socket.getLocalPort();
30     }
31
32     public InputStream getInputStream() throws IOException {
33         return socket.getInputStream();
34     }
35
36     public OutputStream getOutputStream() throws IOException {
37         return socket.getOutputStream();
38     }
39
40     public void setTcpNoDelay(boolean on) throws SocketException {
41         socket.setTcpNoDelay(on);
42     }
43
44     public boolean getTcpNoDelay() throws SocketException {
45         return socket.getTcpNoDelay();
46     }
47
48     public void setSoLinger(boolean on, int linger) throws SocketException {
49         socket.setSoLinger(on, linger);
50     }
51
52     public int getSoLinger() throws SocketException {
53         return socket.getSoLinger();
54     }
55
56     public synchronized void setSoTimeout(int timeout) throws SocketException {
57         socket.setSoTimeout(timeout);
58     }
59
60     public synchronized int getSoTimeout() throws SocketException {
61         return socket.getSoTimeout();
62     }
63
64     public synchronized void setSendBufferSize(int size)
65         throws SocketException {
66         socket.setSendBufferSize(size);
67     }
68
69     public synchronized int getSendBufferSize() throws SocketException {
70         return socket.getSendBufferSize();
71     }
72
73     public synchronized void setReceiveBufferSize(int size)
74         throws SocketException {
75         socket.setReceiveBufferSize(size);
76     }
77
78     public synchronized int getReceiveBufferSize()
79         throws SocketException {
80         return socket.getReceiveBufferSize();
81     }
82
83     public void setKeepAlive(boolean on) throws SocketException {
84         socket.setKeepAlive(on);
85     }
86
87     public boolean getKeepAlive() throws SocketException {
88         return socket.getKeepAlive();
89     }
90
91     public synchronized void close() throws IOException {
92         socket.close();
93     }
94
95     public void shutdownInput() throws IOException {
96         socket.shutdownInput();
97     }
98
99     public void shutdownOutput() throws IOException {
100         socket.shutdownOutput();
101     }
102
103 }
104
Popular Tags