APIdia Launch Partner
Top Description Fields Constructors Methods
java.net

pack-priv Class DelegatingSocketImpl

extends SocketImpl
Class Inheritance
Known Direct Subclasses
java.net.HttpConnectSocketImpl, java.net.SocksSocketImpl
Imports
java.io.FileDescriptor, .IOException, .InputStream, .OutputStream, java.util.Objects, .Set, sun.net.PlatformSocketImpl

A SocketImpl that delegates all methods to another SocketImpl.

Field Summary

Modifier and TypeField and Description
protected final SocketImpl
Inherited from java.net.SocketImpl:
addressfdlocalportport

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

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

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(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.

protected void
connect(SocketAddress address, int timeout)

Implements abstract java.net.SocketImpl.connect.

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

protected void
create(boolean stream)

Implements abstract java.net.SocketImpl.create.

Creates a stream socket.

pack-priv final SocketImpl
protected FileDescriptor
getFileDescriptor()

Overrides java.net.SocketImpl.getFileDescriptor.

Returns the value of this socket's fd field.

protected InetAddress
getInetAddress()

Overrides java.net.SocketImpl.getInetAddress.

Returns the value of this socket's address field.

protected InputStream
getInputStream()

Implements abstract java.net.SocketImpl.getInputStream.

Returns an input stream for this socket.

protected int
getLocalPort()

Overrides java.net.SocketImpl.getLocalPort.

Returns the value of this socket's localport field.

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

Overrides java.net.SocketImpl.getOption.

Called to get a socket option.

public Object
getOption(int optID)

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 int
getPort()

Overrides java.net.SocketImpl.getPort.

Returns the value of this socket's port field.

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 optID, Object value)

Implements java.net.SocketOptions.setOption.

Enable/disable the option specified by optID.

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:
closeQuietlycopyOptionsTocreatePlatformSocketImplresetsetPerformancePreferencestoString

Field Detail

delegateback to summary
protected final SocketImpl delegate

Constructor Detail

DelegatingSocketImplback to summary
pack-priv DelegatingSocketImpl(SocketImpl delegate)

Method Detail

acceptback to summary
protected void accept(SocketImpl s) throws IOException

Implements abstract java.net.SocketImpl.accept.

Doc from java.net.SocketImpl.accept.

Accepts a connection.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs when accepting the connection.
availableback to summary
protected int available() throws IOException

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
Exceptions
IOException:
if an I/O error occurs when determining the number of bytes available.
bindback to summary
protected void bind(InetAddress host, int port) throws IOException

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
Exceptions
IOException:
if an I/O error occurs when binding this socket.
closeback to summary
protected void close() throws IOException

Implements abstract java.net.SocketImpl.close.

Doc from java.net.SocketImpl.close.

Closes this socket.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs when closing this socket.
connectback to summary
protected void connect(String host, int port) throws IOException

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
Exceptions
IOException:
if an I/O error occurs when connecting to the remote host.
connectback to summary
protected void connect(InetAddress address, int port) throws IOException

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
Exceptions
IOException:
if an I/O error occurs when attempting a connection.
connectback to summary
protected void connect(SocketAddress address, int timeout) throws IOException

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
Exceptions
IOException:
if an I/O error occurs when attempting a connection.
createback to summary
protected void create(boolean stream) throws IOException

Implements abstract java.net.SocketImpl.create.

Doc from java.net.SocketImpl.create.

Creates a stream socket.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs while creating the socket.
delegateback to summary
pack-priv final SocketImpl delegate()
getFileDescriptorback to summary
protected FileDescriptor getFileDescriptor()

Overrides java.net.SocketImpl.getFileDescriptor.

Doc from java.net.SocketImpl.getFileDescriptor.

Returns the value of this socket's fd field.

Annotations
@Override
getInetAddressback to summary
protected InetAddress getInetAddress()

Overrides java.net.SocketImpl.getInetAddress.

Doc from java.net.SocketImpl.getInetAddress.

Returns the value of this socket's address field.

Annotations
@Override
getInputStreamback to summary
protected InputStream getInputStream() throws IOException

Implements abstract java.net.SocketImpl.getInputStream.

Doc from java.net.SocketImpl.getInputStream.

Returns an input stream for this socket.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs when creating the input stream.
getLocalPortback to summary
protected int getLocalPort()

Overrides java.net.SocketImpl.getLocalPort.

Doc from java.net.SocketImpl.getLocalPort.

Returns the value of this socket's localport field.

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

Overrides java.net.SocketImpl.getOption.

Doc from java.net.SocketImpl.getOption.

Called to get a socket option.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs, or if the socket is closed
getOptionback to summary
public Object getOption(int optID) throws SocketException

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
Exceptions
SocketException:
if the socket is closed or if optID is unknown along the protocol stack
getOutputStreamback to summary
protected OutputStream getOutputStream() throws IOException

Implements abstract java.net.SocketImpl.getOutputStream.

Doc from java.net.SocketImpl.getOutputStream.

Returns an output stream for this socket.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs when creating the output stream.
getPortback to summary
protected int getPort()

Overrides java.net.SocketImpl.getPort.

Doc from java.net.SocketImpl.getPort.

Returns the value of this socket's port field.

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

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
Exceptions
IOException:
if an I/O error occurs when creating the queue.
sendUrgentDataback to summary
protected void sendUrgentData(int data) throws IOException

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
Exceptions
IOException:
if there is an error sending the data.
setOptionback to summary
protected <T> void setOption(SocketOption<T> opt, T value) throws IOException

Overrides java.net.SocketImpl.setOption.

Doc from java.net.SocketImpl.setOption.

Called to set a socket option.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs, or if the socket is closed
setOptionback to summary
public void setOption(int optID, Object value) throws SocketException

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
Exceptions
SocketException:
if the option is unrecognized, the socket is closed, or some low-level error occurred
shutdownInputback to summary
protected void shutdownInput() throws IOException

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
Exceptions
IOException:
if an I/O error occurs when shutting down this socket.
shutdownOutputback to summary
protected void shutdownOutput() throws IOException

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
Exceptions
IOException:
if an I/O error occurs when shutting down this socket.
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