public class SocketGroovyMethods extends DefaultGroovyMethodsSupport
DefaultGroovyMethodsSupport.RangeInfo| Constructor and Description |
|---|
SocketGroovyMethods() |
| Modifier and Type | Method and Description |
|---|---|
static Socket |
accept(ServerSocket serverSocket,
boolean runInANewThread,
Closure closure)
Accepts a connection and passes the resulting Socket to the closure
which runs in a new Thread or the calling thread, as needed.
|
static Socket |
accept(ServerSocket serverSocket,
Closure closure)
Accepts a connection and passes the resulting Socket to the closure
which runs in a new Thread.
|
static OutputStream |
leftShift(Socket self,
byte[] value)
Overloads the left shift operator to provide an append mechanism
to add bytes to the output stream of a socket
|
static Writer |
leftShift(Socket self,
Object value)
Overloads the left shift operator to provide an append mechanism to
add things to the output stream of a socket
|
static <T> T |
withObjectStreams(Socket socket,
Closure<T> closure)
Creates an InputObjectStream and an OutputObjectStream from a Socket, and
passes them to the closure.
|
static <T> T |
withStreams(Socket socket,
Closure<T> closure)
Passes the Socket's InputStream and OutputStream to the closure.
|
cloneSimilarCollection, cloneSimilarMap, closeQuietly, closeWithWarning, createSimilarArray, createSimilarCollection, createSimilarCollection, createSimilarList, createSimilarMap, createSimilarOrDefaultCollection, createSimilarSet, normaliseIndex, sameType, subListBorders, subListBorderspublic static <T> T withStreams(Socket socket, Closure<T> closure) throws IOException
socket - a Socketclosure - a ClosureIOException - if an IOException occurs.public static <T> T withObjectStreams(Socket socket, Closure<T> closure) throws IOException
socket - this Socketclosure - a ClosureIOException - if an IOException occurs.public static Writer leftShift(Socket self, Object value) throws IOException
self - a Socketvalue - a value to appendIOException - if an IOException occurs.public static OutputStream leftShift(Socket self, byte[] value) throws IOException
self - a Socketvalue - a value to appendIOException - if an IOException occurs.public static Socket accept(ServerSocket serverSocket, Closure closure) throws IOException
serverSocket - a ServerSocketclosure - a ClosureIOException - if an IOException occurs.ServerSocket.accept()public static Socket accept(ServerSocket serverSocket, boolean runInANewThread, Closure closure) throws IOException
serverSocket - a ServerSocketrunInANewThread - This flag should be true, if the closure should be invoked in a new thread, else false.closure - a ClosureIOException - if an IOException occurs.ServerSocket.accept()