Package org.jruby.ext.socket
Enum SocketType
- All Implemented Interfaces:
Serializable,Comparable<SocketType>,java.lang.constant.Constable
Encapsulates behavior across the primary socket types Socket,
ServerSocket, and Datagramsocket.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanasBoolean(int value) static SocketTypeforChannel(Channel channel) booleangetBroadcast(Channel channel) booleangetKeepAlive(Channel channel) getLocalSocketAddress(Channel channel) booleangetOOBInline(Channel channel) intgetReceiveBufferSize(Channel channel) getRemoteSocketAddress(Channel channel) booleangetReuseAddress(Channel channel) intgetSendBufferSize(Channel channel) intgetSocketOption(Channel channel, jnr.constants.platform.SocketOption option) jnr.constants.platform.SockintgetSoLinger(Channel channel) intgetSoTimeout(Channel channel) booleangetTcpNoDelay(Channel channel) voidsetBroadcast(Channel channel, boolean b) voidsetKeepAlive(Channel channel, boolean b) voidsetOOBInline(Channel channel, boolean b) voidsetReceiveBufferSize(Channel channel, int i) voidsetReuseAddress(Channel channel, boolean reuse) voidsetSendBufferSize(Channel channel, int size) voidsetSocketOption(Channel channel, jnr.constants.platform.SocketOption option, int value) voidsetSoLinger(Channel channel, boolean b, int i) voidsetSoTimeout(Channel channel, int timeout) voidsetTcpNoDelay(Channel channel, boolean b) voidshutdownInput(Channel channel) voidshutdownOutput(Channel channel) static SocketTypeReturns the enum constant of this type with the specified name.static SocketType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
SOCKET
-
SERVER
-
DATAGRAM
-
UNIX
-
UNKNOWN
-
-
Field Details
-
sock
private final jnr.constants.platform.Sock sock
-
-
Constructor Details
-
SocketType
private SocketType(jnr.constants.platform.Sock sock)
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
forChannel
-
getSoTimeout
- Throws:
IOException
-
setSoTimeout
- Throws:
IOException
-
getReuseAddress
- Throws:
IOException
-
setReuseAddress
- Throws:
IOException
-
getSendBufferSize
- Throws:
IOException
-
setSendBufferSize
- Throws:
IOException
-
getReceiveBufferSize
- Throws:
IOException
-
setReceiveBufferSize
- Throws:
IOException
-
getOOBInline
- Throws:
IOException
-
setOOBInline
- Throws:
IOException
-
getSoLinger
- Throws:
IOException
-
setSoLinger
- Throws:
IOException
-
getKeepAlive
- Throws:
IOException
-
setKeepAlive
- Throws:
IOException
-
getTcpNoDelay
- Throws:
IOException
-
setTcpNoDelay
- Throws:
IOException
-
getBroadcast
- Throws:
IOException
-
setBroadcast
- Throws:
IOException
-
shutdownInput
- Throws:
IOException
-
shutdownOutput
- Throws:
IOException
-
getRemoteSocketAddress
-
getLocalSocketAddress
-
getSocketType
public jnr.constants.platform.Sock getSocketType() -
getSocketOption
public int getSocketOption(Channel channel, jnr.constants.platform.SocketOption option) throws IOException - Throws:
IOException
-
setSocketOption
public void setSocketOption(Channel channel, jnr.constants.platform.SocketOption option, int value) throws IOException - Throws:
IOException
-
asBoolean
private static boolean asBoolean(int value)
-