Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Type | Name and description |
---|---|
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 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 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 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 T |
withObjectStreams(Socket socket, Closure<T> closure) Creates an InputObjectStream and an OutputObjectStream from a Socket, and passes them to the closure. |
static T |
withStreams(Socket socket, Closure<T> closure) Passes the Socket's InputStream and OutputStream to the closure. |
Methods inherited from class | Name |
---|---|
class DefaultGroovyMethodsSupport |
cloneSimilarCollection, cloneSimilarMap, closeQuietly, closeWithWarning, createSimilarArray, createSimilarCollection, createSimilarCollection, createSimilarCollection, createSimilarList, createSimilarMap, createSimilarOrDefaultCollection, createSimilarSet, normaliseIndex, sameType, subListBorders, subListBorders |
class Object |
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Accepts a connection and passes the resulting Socket to the closure which runs in a new Thread.
serverSocket
- a ServerSocketclosure
- a ClosureAccepts a connection and passes the resulting Socket to the closure which runs in a new Thread or the calling thread, as needed.
serverSocket
- a ServerSocketrunInANewThread
- This flag should be true, if the closure should be invoked in a new thread, else false.closure
- a ClosureOverloads the left shift operator to provide an append mechanism to add things to the output stream of a socket
self
- a Socketvalue
- a value to appendOverloads the left shift operator to provide an append mechanism to add bytes to the output stream of a socket
self
- a Socketvalue
- a value to appendCreates 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.
socket
- this Socketclosure
- a ClosurePasses the Socket's InputStream and OutputStream to the closure. The streams will be closed after the closure returns, even if an exception is thrown.
socket
- a Socketclosure
- a Closure