author | alanb |
Mon, 11 Feb 2019 08:39:50 +0000 | |
branch | niosocketimpl-branch |
changeset 57175 | 7eb6cdd1204a |
parent 57172 | 63ab5af5d009 |
child 57176 | 726630bc6a4c |
permissions | -rw-r--r-- |
57172 | 1 |
/* |
2 |
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. |
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
package java.net; |
|
26 |
||
27 |
import java.io.FileDescriptor; |
|
28 |
import java.io.IOException; |
|
29 |
import java.io.InputStream; |
|
30 |
import java.io.OutputStream; |
|
31 |
import java.util.Objects; |
|
32 |
import java.util.Set; |
|
33 |
||
57175
7eb6cdd1204a
More cleanup. Also fix up jshell tests that depend on exception messages
alanb
parents:
57172
diff
changeset
|
34 |
import sun.net.TrustedSocketImpl; |
7eb6cdd1204a
More cleanup. Also fix up jshell tests that depend on exception messages
alanb
parents:
57172
diff
changeset
|
35 |
|
57172 | 36 |
/** |
37 |
* A SocketImpl that delegates all methods to another SocketImpl. |
|
38 |
*/ |
|
39 |
||
40 |
class DelegatingSocketImpl extends SocketImpl { |
|
41 |
protected final SocketImpl delegate; |
|
42 |
||
43 |
DelegatingSocketImpl(SocketImpl delegate) { |
|
57175
7eb6cdd1204a
More cleanup. Also fix up jshell tests that depend on exception messages
alanb
parents:
57172
diff
changeset
|
44 |
assert delegate instanceof TrustedSocketImpl; |
57172 | 45 |
this.delegate = Objects.requireNonNull(delegate); |
46 |
} |
|
47 |
||
48 |
final SocketImpl delegate() { |
|
49 |
return delegate; |
|
50 |
} |
|
51 |
||
52 |
@Override |
|
53 |
protected FileDescriptor getFileDescriptor() { |
|
54 |
return delegate.getFileDescriptor(); |
|
55 |
} |
|
56 |
||
57 |
@Override |
|
58 |
protected InetAddress getInetAddress() { |
|
59 |
return delegate.getInetAddress(); |
|
60 |
} |
|
61 |
||
62 |
@Override |
|
63 |
protected int getPort() { |
|
64 |
return delegate.getPort(); |
|
65 |
} |
|
66 |
||
67 |
@Override |
|
68 |
protected int getLocalPort() { |
|
69 |
return delegate.getLocalPort(); |
|
70 |
} |
|
71 |
||
72 |
@Override |
|
73 |
protected void create(boolean stream) throws IOException { |
|
74 |
delegate.create(stream); |
|
75 |
} |
|
76 |
||
77 |
@Override |
|
78 |
protected void connect(String host, int port) throws IOException { |
|
79 |
delegate.connect(host, port); |
|
80 |
} |
|
81 |
||
82 |
@Override |
|
83 |
protected void connect(InetAddress address, int port) throws IOException { |
|
84 |
delegate.connect(address, port); |
|
85 |
} |
|
86 |
||
87 |
@Override |
|
88 |
protected void connect(SocketAddress address, int timeout) throws IOException { |
|
89 |
delegate.connect(address, timeout); |
|
90 |
} |
|
91 |
||
92 |
@Override |
|
93 |
protected void bind(InetAddress host, int port) throws IOException { |
|
94 |
delegate.bind(host, port); |
|
95 |
} |
|
96 |
||
97 |
@Override |
|
98 |
protected void listen(int backlog) throws IOException { |
|
99 |
delegate.listen(backlog); |
|
100 |
} |
|
101 |
||
102 |
@Override |
|
103 |
protected void accept(SocketImpl s) throws IOException { |
|
104 |
delegate.accept(s); |
|
105 |
} |
|
106 |
||
107 |
@Override |
|
108 |
protected InputStream getInputStream() throws IOException { |
|
109 |
return delegate.getInputStream(); |
|
110 |
} |
|
111 |
||
112 |
@Override |
|
113 |
protected OutputStream getOutputStream() throws IOException { |
|
114 |
return delegate.getOutputStream(); |
|
115 |
} |
|
116 |
||
117 |
@Override |
|
118 |
protected int available() throws IOException { |
|
119 |
return delegate.available(); |
|
120 |
} |
|
121 |
||
122 |
@Override |
|
123 |
protected void close() throws IOException { |
|
124 |
delegate.close(); |
|
125 |
} |
|
126 |
||
127 |
@Override |
|
128 |
protected boolean supportsUrgentData() { |
|
129 |
return delegate.supportsUrgentData(); |
|
130 |
} |
|
131 |
||
132 |
@Override |
|
133 |
protected void sendUrgentData(int data) throws IOException { |
|
134 |
delegate.sendUrgentData(data); |
|
135 |
} |
|
136 |
||
137 |
@Override |
|
138 |
protected Set<SocketOption<?>> supportedOptions() { |
|
139 |
return delegate.supportedOptions(); |
|
140 |
} |
|
141 |
||
142 |
@Override |
|
143 |
protected <T> void setOption(SocketOption<T> opt, T value) throws IOException { |
|
144 |
delegate.setOption(opt, value); |
|
145 |
} |
|
146 |
||
147 |
@Override |
|
148 |
protected <T> T getOption(SocketOption<T> opt) throws IOException { |
|
149 |
return delegate.getOption(opt); |
|
150 |
} |
|
151 |
||
152 |
@Override |
|
153 |
public void setOption(int optID, Object value) throws SocketException { |
|
154 |
delegate.setOption(optID, value); |
|
155 |
} |
|
156 |
||
157 |
@Override |
|
158 |
public Object getOption(int optID) throws SocketException { |
|
159 |
return delegate.getOption(optID); |
|
160 |
} |
|
161 |
||
162 |
@Override |
|
163 |
protected void shutdownInput() throws IOException { |
|
164 |
delegate.shutdownInput(); |
|
165 |
} |
|
166 |
||
167 |
@Override |
|
168 |
protected void shutdownOutput() throws IOException { |
|
169 |
delegate.shutdownOutput(); |
|
170 |
} |
|
171 |
} |