public final class SocketUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
configureConnection(DatagramSocket socket,
UdpSocketProperties socketProperties)
Sets the configuration parameters into the socket.
|
static void |
configureConnection(Socket socket,
TcpSocketProperties socketProperties)
Sets the configuration parameters into the socket
|
static DatagramPacket |
createPacket(byte[] content)
Creates a
DatagramPacket with the size of the content, addressed to the port and address of the client. |
static DatagramPacket |
createPacket(int bufferSize) |
static org.mule.runtime.extension.api.runtime.operation.Result<InputStream,SocketAttributes> |
createResult(InputStream content,
SocketAttributes attributes) |
static byte[] |
getByteArray(Object data,
boolean streamingIsAllowed,
String encoding,
ObjectSerializer objectSerializer) |
static byte[] |
getUdpAllowedByteArray(Object data,
String encoding,
ObjectSerializer objectSerializer)
UDP doesn't allow streaming and it always sends payload when dealing with a
Message |
static org.mule.runtime.api.connection.ConnectionValidationResult |
validate(AbstractSocketConnection connection) |
public static final String WORK
public static byte[] getUdpAllowedByteArray(Object data, String encoding, ObjectSerializer objectSerializer) throws IOException
MessageIOExceptionpublic static byte[] getByteArray(Object data, boolean streamingIsAllowed, String encoding, ObjectSerializer objectSerializer) throws IOException
IOExceptionpublic static org.mule.runtime.api.connection.ConnectionValidationResult validate(AbstractSocketConnection connection)
connection - delegates connectin's validation on SocketConnection.validate()ConnectionValidationResult with the outcome of the validationpublic static org.mule.runtime.extension.api.runtime.operation.Result<InputStream,SocketAttributes> createResult(InputStream content, SocketAttributes attributes)
public static DatagramPacket createPacket(byte[] content) throws UnresolvableHostException
DatagramPacket with the size of the content, addressed to the port and address of the client.content - that is going to be sent inside the packetUnresolvableHostExceptionpublic static DatagramPacket createPacket(int bufferSize) throws UnresolvableHostException
UnresolvableHostExceptionpublic static void configureConnection(DatagramSocket socket, UdpSocketProperties socketProperties) throws org.mule.runtime.api.connection.ConnectionException
socket - UDP SocketsocketProperties - Configuration propertiesorg.mule.runtime.api.connection.ConnectionExceptionpublic static void configureConnection(Socket socket, TcpSocketProperties socketProperties) throws org.mule.runtime.api.connection.ConnectionException
socket - TCP SocketsocketProperties - Configuration propertiesorg.mule.runtime.api.connection.ConnectionExceptionCopyright © 2003–2017 MuleSoft, Inc.. All rights reserved.