trait ClientAttach[A <: ClientAttach[A]] extends AnyRef
Stores data associated to one TCP client. This abstract class provides basic reading and writing functionnality. Additionnal information and features may be added by the subclasses.
Thread-safety
- The public methods of ClientAttach may be called from any thread without problem.
- The protected methods are called from the Selector thread. In particular, HAttach.readHeader and ClientAttach.handleData don't need to be thread-safe.
- The completion handlers are run on the Selector thread. Therefore they should NOT perform long computations. If you have long computations to do, send them to an ExecutorService or something similar.
- Alphabetic
- By Inheritance
- ClientAttach
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
handleData(buffer: NiolBuffer): Unit
Handles the packet's data.
Handles the packet's data.
- buffer
the buffer view containing all the packet's data.
- Attributes
- protected
-
abstract
def
listener: TcpListener[A]
Returns the TcpListener to notify when the client disconnects.
Returns the TcpListener to notify when the client disconnects.
- returns
the TcpListener associated to this ClientAttach.
-
abstract
def
readMore(): Unit
Reads more data from the SocketChannel.
Reads more data from the SocketChannel.
- Attributes
- protected[network]
-
abstract
def
readTransform: Option[BytesTransform]
Returns the function that transforms the received data.
Returns the function that transforms the received data.
- returns
the function, if any
-
abstract
def
readTransform_=(t: BytesTransform): Unit
Sets the function that is applied to the received data just after its receipt.
Sets the function that is applied to the received data just after its receipt. The function is applied before the packets are reconstructed.
To handle the packets, override the ClientAttach.handleData method.
- t
the function
-
abstract
def
streamEnded: Boolean
Checks if the end of the stream has been reached.
Checks if the end of the stream has been reached.
- returns
true if the end of the stream has been reached, false otherwise
-
abstract
def
write(buffer: NiolBuffer, completionHandler: () ⇒ Unit): Unit
Asynchronously writes some data to the client, and executes the given completion handler when the operation completes.
Asynchronously writes some data to the client, and executes the given completion handler when the operation completes.
- buffer
the data to write
- completionHandler
the handler to execute after the operation
-
abstract
def
write(buffer: NiolBuffer): Unit
Writes some data to the client.
Writes some data to the client. The data isn't written immediately but at some time in the future. Therefore this method isn't blocking.
- buffer
the data to write
-
abstract
def
writeMore(): Boolean
Writes more pending data, if any, to the SocketChannel.
Writes more pending data, if any, to the SocketChannel.
- returns
true if all the pending data has been written, false otherwise
- Attributes
- protected[network]
-
abstract
def
writeTransform: Option[BytesTransform]
Returns the function that transforms the outgoing data.
Returns the function that transforms the outgoing data.
- returns
the function, if any
-
abstract
def
writeTransform_=(t: BytesTransform): Unit
Sets the function that is applied to the outgoing data just before its sending.
Sets the function that is applied to the outgoing data just before its sending.
- t
the function
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()