APIdia Launch Partner
Top Description Fields Constructors Methods
sun.nio.ch

pack-priv Class DummySocketImpl

extends SocketImpl
Class Inheritance
Imports
java.io.InputStream, .OutputStream, java.net.InetAddress, .SocketAddress, .SocketImpl, .SocketOption, java.util.Set

Dummy SocketImpl for use by the socket adaptors. All methods are overridden to throw an error.

Field Summary

Inherited from java.net.SocketImpl:
addressfdlocalportport

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
protected void
accept(SocketImpl si)

Implements abstract java.net.SocketImpl.accept.

Accepts a connection.

protected int
available()

Implements abstract java.net.SocketImpl.available.

Returns the number of bytes that can be read from this socket without blocking.

protected void
bind(InetAddress host, int port)

Implements abstract java.net.SocketImpl.bind.

Binds this socket to the specified local IP address and port number.

protected void
close()

Implements abstract java.net.SocketImpl.close.

Closes this socket.

protected void
connect(SocketAddress remote, int millis)

Implements abstract java.net.SocketImpl.connect.

Connects this socket to the specified port number on the specified host.

protected void
connect(String host, int port)

Implements abstract java.net.SocketImpl.connect.

Connects this socket to the specified port on the named host.

protected void
connect(InetAddress address, int port)

Implements abstract java.net.SocketImpl.connect.

Connects this socket to the specified port number on the specified host.

pack-priv static SocketImpl
protected void
create(boolean stream)

Implements abstract java.net.SocketImpl.create.

Creates a stream socket.

protected InputStream
getInputStream()

Implements abstract java.net.SocketImpl.getInputStream.

Returns an input stream for this socket.

protected <T> T
getOption(SocketOption<T> opt)

Overrides java.net.SocketImpl.getOption.

Called to get a socket option.

public Object
getOption(int opt)

Implements java.net.SocketOptions.getOption.

Fetch the value of an option.

protected OutputStream
getOutputStream()

Implements abstract java.net.SocketImpl.getOutputStream.

Returns an output stream for this socket.

protected void
listen(int backlog)

Implements abstract java.net.SocketImpl.listen.

Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument.

protected void
sendUrgentData(int data)

Implements abstract java.net.SocketImpl.sendUrgentData.

Send one byte of urgent data on the socket.

protected <T> void
setOption(SocketOption<T> opt, T value)

Overrides java.net.SocketImpl.setOption.

Called to set a socket option.

public void
setOption(int opt, Object value)

Implements java.net.SocketOptions.setOption.

Enable/disable the option specified by optID.

private static <T> T
protected void
shutdownInput()

Overrides java.net.SocketImpl.shutdownInput.

Places the input stream for this socket at "end of stream".

protected void
shutdownOutput()

Overrides java.net.SocketImpl.shutdownOutput.

Disables the output stream for this socket.

protected Set<SocketOption<?>>
supportedOptions()

Overrides java.net.SocketImpl.supportedOptions.

Returns a set of SocketOptions supported by this impl and by this impl's socket (Socket or ServerSocket)

protected boolean
supportsUrgentData()

Overrides java.net.SocketImpl.supportsUrgentData.

Returns whether or not this SocketImpl supports sending urgent data.

Inherited from java.net.SocketImpl:
getFileDescriptorgetInetAddressgetLocalPortgetPortsetPerformancePreferencestoString

Constructor Detail

DummySocketImplback to summary
private DummySocketImpl()

Method Detail

acceptback to summary
protected void accept(SocketImpl si)

Implements abstract java.net.SocketImpl.accept.

Doc from java.net.SocketImpl.accept.

Accepts a connection.

Annotations
@Override
availableback to summary
protected int available()

Implements abstract java.net.SocketImpl.available.

Doc from java.net.SocketImpl.available.

Returns the number of bytes that can be read from this socket without blocking.

Annotations
@Override
bindback to summary
protected void bind(InetAddress host, int port)

Implements abstract java.net.SocketImpl.bind.

Doc from java.net.SocketImpl.bind.

Binds this socket to the specified local IP address and port number.

Annotations
@Override
closeback to summary
protected void close()

Implements abstract java.net.SocketImpl.close.

Doc from java.net.SocketImpl.close.

Closes this socket.

Annotations
@Override
connectback to summary
protected void connect(SocketAddress remote, int millis)

Implements abstract java.net.SocketImpl.connect.

Doc from java.net.SocketImpl.connect.

Connects this socket to the specified port number on the specified host. A timeout of zero is interpreted as an infinite timeout. The connection will then block until established or an error occurs.

Annotations
@Override
connectback to summary
protected void connect(String host, int port)

Implements abstract java.net.SocketImpl.connect.

Doc from java.net.SocketImpl.connect.

Connects this socket to the specified port on the named host.

Annotations
@Override
connectback to summary
protected void connect(InetAddress address, int port)

Implements abstract java.net.SocketImpl.connect.

Doc from java.net.SocketImpl.connect.

Connects this socket to the specified port number on the specified host.

Annotations
@Override
createback to summary
pack-priv static SocketImpl create()
createback to summary
protected void create(boolean stream)

Implements abstract java.net.SocketImpl.create.

Doc from java.net.SocketImpl.create.

Creates a stream socket.

Annotations
@Override
getInputStreamback to summary
protected InputStream getInputStream()

Implements abstract java.net.SocketImpl.getInputStream.

Doc from java.net.SocketImpl.getInputStream.

Returns an input stream for this socket.

Annotations
@Override
getOptionback to summary
protected <T> T getOption(SocketOption<T> opt)

Overrides java.net.SocketImpl.getOption.

Doc from java.net.SocketImpl.getOption.

Called to get a socket option.

Annotations
@Override
getOptionback to summary
public Object getOption(int opt)

Implements java.net.SocketOptions.getOption.

Doc from java.net.SocketOptions.getOption.

Fetch the value of an option. Binary options will return Boolean#TRUE if enabled, Boolean#FALSE if disabled, e.g.:

SocketImpl s; ... Boolean noDelay = (Boolean)(s.getOption(TCP_NODELAY)); if (noDelay.booleanValue()) { // true if TCP_NODELAY is enabled... ... }
SocketImpl s;
...
Boolean noDelay = (Boolean)(s.getOption(TCP_NODELAY));
if (noDelay.booleanValue()) {
    // true if TCP_NODELAY is enabled...
...
}

For options that take a particular type as a parameter, this method will return the parameter's value, else it will return Boolean#FALSE:

Object o = s.getOption(SO_LINGER); if (o instanceof Integer) { System.out.print("Linger time is " + ((Integer)o).intValue()); } else { // the true type of o is java.lang.Boolean.FALSE; }
Object o = s.getOption(SO_LINGER);
if (o instanceof Integer) {
    System.out.print("Linger time is " + ((Integer)o).intValue());
} else {
  // the true type of o is java.lang.Boolean.FALSE;
}
Annotations
@Override
getOutputStreamback to summary
protected OutputStream getOutputStream()

Implements abstract java.net.SocketImpl.getOutputStream.

Doc from java.net.SocketImpl.getOutputStream.

Returns an output stream for this socket.

Annotations
@Override
listenback to summary
protected void listen(int backlog)

Implements abstract java.net.SocketImpl.listen.

Doc from java.net.SocketImpl.listen.

Sets the maximum queue length for incoming connection indications (a request to connect) to the count argument. If a connection indication arrives when the queue is full, the connection is refused.

Annotations
@Override
sendUrgentDataback to summary
protected void sendUrgentData(int data)

Implements abstract java.net.SocketImpl.sendUrgentData.

Doc from java.net.SocketImpl.sendUrgentData.

Send one byte of urgent data on the socket. The byte to be sent is the low eight bits of the parameter

Annotations
@Override
setOptionback to summary
protected <T> void setOption(SocketOption<T> opt, T value)

Overrides java.net.SocketImpl.setOption.

Doc from java.net.SocketImpl.setOption.

Called to set a socket option.

Annotations
@Override
setOptionback to summary
public void setOption(int opt, Object value)

Implements java.net.SocketOptions.setOption.

Doc from java.net.SocketOptions.setOption.

Enable/disable the option specified by optID. If the option is to be enabled, and it takes an option-specific "value", this is passed in value. The actual type of value is option-specific, and it is an error to pass something that isn't of the expected type:

SocketImpl s; ... s.setOption(SO_LINGER, Integer.valueOf(10)); // OK - set SO_LINGER w/ timeout of 10 sec. s.setOption(SO_LINGER, Double.valueOf(10)); // ERROR - expects java.lang.Integer
SocketImpl s;
...
s.setOption(SO_LINGER, Integer.valueOf(10));
   // OK - set SO_LINGER w/ timeout of 10 sec.
s.setOption(SO_LINGER, Double.valueOf(10));
   // ERROR - expects java.lang.Integer
If the requested option is binary, it can be set using this method by a Boolean:
s.setOption(TCP_NODELAY, Boolean.TRUE); // OK - enables TCP_NODELAY, a binary option
s.setOption(TCP_NODELAY, Boolean.TRUE);
   // OK - enables TCP_NODELAY, a binary option
Any option can be disabled using this method with a Boolean#FALSE:
s.setOption(TCP_NODELAY, Boolean.FALSE); // OK - disables TCP_NODELAY s.setOption(SO_LINGER, Boolean.FALSE); // OK - disables SO_LINGER
s.setOption(TCP_NODELAY, Boolean.FALSE);
   // OK - disables TCP_NODELAY
s.setOption(SO_LINGER, Boolean.FALSE);
   // OK - disables SO_LINGER
For an option that has a notion of on and off, and requires a non-boolean parameter, setting its value to anything other than Boolean#FALSE implicitly enables it.
Annotations
@Override
shouldNotGetHereback to summary
private static <T> T shouldNotGetHere()
shutdownInputback to summary
protected void shutdownInput()

Overrides java.net.SocketImpl.shutdownInput.

Doc from java.net.SocketImpl.shutdownInput.

Places the input stream for this socket at "end of stream". Any data sent to this socket is acknowledged and then silently discarded. If you read from a socket input stream after invoking this method on the socket, the stream's available method will return 0, and its read methods will return -1 (end of stream).

Annotations
@Override
shutdownOutputback to summary
protected void shutdownOutput()

Overrides java.net.SocketImpl.shutdownOutput.

Doc from java.net.SocketImpl.shutdownOutput.

Disables the output stream for this socket. For a TCP socket, any previously written data will be sent followed by TCP's normal connection termination sequence. If you write to a socket output stream after invoking shutdownOutput() on the socket, the stream will throw an IOException.

Annotations
@Override
supportedOptionsback to summary
protected Set<SocketOption<?>> supportedOptions()

Overrides java.net.SocketImpl.supportedOptions.

Doc from java.net.SocketImpl.supportedOptions.

Returns a set of SocketOptions supported by this impl and by this impl's socket (Socket or ServerSocket)

Annotations
@Override
supportsUrgentDataback to summary
protected boolean supportsUrgentData()

Overrides java.net.SocketImpl.supportsUrgentData.

Doc from java.net.SocketImpl.supportsUrgentData.

Returns whether or not this SocketImpl supports sending urgent data. By default, false is returned unless the method is overridden in a sub-class

Annotations
@Override