Groovy JDK

java.net
Class Socket

Method Summary
Writer leftShift(Object value)
Overloads the left shift operator to provide an append mechanism to add things to the output stream of a socket
OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to add bytes to the output stream of a socket
Object withObjectStreams(Closure closure)
Creates an InputObjectStream and an OutputObjectStream from a Socket, and passes them to the closure returns, even if an exception is thrown
Object withStreams(Closure closure)
Passes the Socket's InputStream and OutputStream to the closure streams will be closed after the closure returns, even if an exception is thrown
 
Method Detail

leftShift

public Writer leftShift(Object value)
Overloads the left shift operator to provide an append mechanism to add things to the output stream of a socket

Parameters:
value - a value to append.
Returns:
a Writer

leftShift

public OutputStream leftShift(byte[] value)
Overloads the left shift operator to provide an append mechanism to add bytes to the output stream of a socket

Parameters:
value - a value to append.
Returns:
an OutputStream

withObjectStreams

public Object withObjectStreams(Closure closure)
Creates an InputObjectStream and an OutputObjectStream from a Socket, and passes them to the closure. The streams will be closed after the closure returns, even if an exception is thrown.

Parameters:
closure - a Closure.
Returns:
the value returned by the closure

withStreams

public Object withStreams(Closure closure)
Passes the Socket's InputStream and OutputStream to the closure. The streams will be closed after the closure returns, even if an exception is thrown.

Parameters:
closure - a Closure.
Returns:
the value returned by the closure

Groovy JDK