Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.base/share/classes/sun/nio/ch/DummySocketImpl.java
41159 views
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
26
package sun.nio.ch;
27
28
import java.io.InputStream;
29
import java.io.OutputStream;
30
import java.net.InetAddress;
31
import java.net.SocketAddress;
32
import java.net.SocketImpl;
33
import java.net.SocketOption;
34
import java.util.Set;
35
36
/**
37
* Dummy SocketImpl for use by the socket adaptors. All methods are overridden
38
* to throw an error.
39
*/
40
41
class DummySocketImpl extends SocketImpl {
42
private DummySocketImpl() { }
43
44
static SocketImpl create() {
45
return new DummySocketImpl();
46
}
47
48
private static <T> T shouldNotGetHere() {
49
throw new InternalError("Should not get here");
50
}
51
52
@Override
53
protected void create(boolean stream) {
54
shouldNotGetHere();
55
}
56
57
@Override
58
protected void connect(SocketAddress remote, int millis) {
59
shouldNotGetHere();
60
}
61
62
@Override
63
protected void connect(String host, int port) {
64
shouldNotGetHere();
65
}
66
67
@Override
68
protected void connect(InetAddress address, int port) {
69
shouldNotGetHere();
70
}
71
72
@Override
73
protected void bind(InetAddress host, int port) {
74
shouldNotGetHere();
75
}
76
77
@Override
78
protected void listen(int backlog) {
79
shouldNotGetHere();
80
}
81
82
@Override
83
protected void accept(SocketImpl si) {
84
shouldNotGetHere();
85
}
86
87
@Override
88
protected InputStream getInputStream() {
89
return shouldNotGetHere();
90
}
91
@Override
92
protected OutputStream getOutputStream() {
93
return shouldNotGetHere();
94
}
95
@Override
96
protected int available() {
97
return shouldNotGetHere();
98
}
99
100
@Override
101
protected void close() {
102
shouldNotGetHere();
103
}
104
105
@Override
106
protected Set<SocketOption<?>> supportedOptions() {
107
return shouldNotGetHere();
108
}
109
110
@Override
111
protected <T> void setOption(SocketOption<T> opt, T value) {
112
shouldNotGetHere();
113
}
114
115
@Override
116
protected <T> T getOption(SocketOption<T> opt) {
117
return shouldNotGetHere();
118
}
119
120
@Override
121
public void setOption(int opt, Object value) {
122
shouldNotGetHere();
123
}
124
125
@Override
126
public Object getOption(int opt) {
127
return shouldNotGetHere();
128
}
129
130
@Override
131
protected void shutdownInput() {
132
shouldNotGetHere();
133
}
134
135
@Override
136
protected void shutdownOutput() {
137
shouldNotGetHere();
138
}
139
140
@Override
141
protected boolean supportsUrgentData() {
142
return shouldNotGetHere();
143
}
144
145
@Override
146
protected void sendUrgentData(int data) {
147
shouldNotGetHere();
148
}
149
}
150
151