abstract class HAttach[A <: HAttach[A]] extends ClientAttach[A]
An implementation of ClientAttach that processes packets that are prefixed by a header (hence the H in HAttach).
- A
generic parameter
- Alphabetic
- By Inheritance
- HAttach
- ClientAttach
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
HAttach(sci: ServerChannelInfos[A], channel: SocketChannel, selectionKey: SelectionKey, rTransform: BytesTransform = null, wTransform: BytesTransform = null)
- sci
infos about the ServerSocketChannel that accepted the client's connection
- channel
the SocketChannel used to communicate with the client
- selectionKey
the key representing the registration of the SocketChannel with the server
- rTransform
a transformation to apply on the read data (received from the client)
- wTransform
a transformation to apply on the written data (sent to the client)
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
- Definition Classes
- ClientAttach
-
abstract
def
makeHeader(data: NiolBuffer): NiolBuffer
Constructs a packet's header.
Constructs a packet's header. This method should NOT advance the read position of the
databuffer. If you need to read the packet's content, you should use NiolBuffer.duplicate first.- data
the packet's content
- returns
a buffer containing the header's bytes
- Attributes
- protected
-
abstract
def
readHeader(buffer: NiolBuffer): Int
Tries to read the packet's header.
Tries to read the packet's header.
- buffer
the buffer view containing the header
- returns
the length, in bytes, of the next packet data, or -1 if the header is incomplete.
- Attributes
- protected
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
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.
- Definition Classes
- HAttach → ClientAttach
-
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
readMore(): Unit
Reads more data from the SocketChannel.
Reads more data from the SocketChannel.
- Attributes
- protected[network]
- Definition Classes
- HAttach → ClientAttach
- Annotations
- @tailrec()
-
final
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
- Definition Classes
- HAttach → ClientAttach
-
final
def
readTransform_=(f: 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.
- Definition Classes
- HAttach → ClientAttach
-
final
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
- Definition Classes
- HAttach → ClientAttach
-
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()
-
final
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.
This method constructs a header and prepends it to the data.
- buffer
the data to write, not prefixed by a header
- completionHandler
the handler to execute after the operation
- Definition Classes
- HAttach → ClientAttach
-
final
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.
This method constructs a header and prepends it to the data.
- buffer
the data to write, not prefixed by a header
- Definition Classes
- HAttach → ClientAttach
-
final
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]
- Definition Classes
- HAttach → ClientAttach
-
final
def
writeRaw(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.
This method doesn't construct a header, you need to provide it.
- buffer
the data to write, prefixed by a header
- completionHandler
the handler to execute after the operation
- See also
()=>Unit)
-
final
def
writeRaw(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.
This method doesn't construct a header, you need to provide it.
- buffer
the data to write, prefixed by a header
- See also
write(NiolBuffer)
-
final
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
- Definition Classes
- HAttach → ClientAttach
-
final
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
- Definition Classes
- HAttach → ClientAttach