network.serializers.data - Palamecia/mint GitHub Wiki
Module
load network.serializers.data
This module provides the Network.DataSerializer class which implement the serializer interface for fixed length messages on a stream based end point such as Network.TcpIp.
Packages
Classes
Network.DataSerializer
This class provides a serializer for fixed length messages. The message length is passed to the constructor. This class can not be passed to an instance of Network.AsynchronousChannel as is but must be used with a decorator.
Example:
channel = Network.AsynchronousChannel(endpoint, def { return Network.DataSerializer(1024) })
Members
Modifiers | Member | Description |
---|---|---|
+ const |
accept | Attempts to accept a connection on the end point. This method raises an insta... |
+ const |
appendMessage | Appends the message object provided by message to the serializer's buffer. ... |
+ const |
containsMessage | Returns true if the serializer's buffer contains at least the configured am... |
+ const |
isEmpty | Returns true if the serializer's buffer is empty; otherwise returns false . |
- final |
length | Internal fixed length. |
+ const |
new | Creates a new serializer for messages of fixed length length . |
+ const |
nextMessage | Returns the next message in the serializer's buffer as an array of uint8 with... |
+ const |
read | Attempts to read data from the end point. Returns true if data was receive;... |
- final |
stream | Internal buffer. |
+ const |
write | Attempts to write data to the end point. Returns true if the data was succe... |
Descriptions
Network.DataSerializer.accept
def (self, endpoint)
Attempts to accept a connection on the end point. This method raises an instance of Exception.InvalidNetworkOperation.
Network.DataSerializer.appendMessage
def (self, message)
Appends the message object provided by message
to the serializer's
buffer. The message
parameter must convert to a byte sequence with
a length equal to the fixed length configured for this serializer.
Network.DataSerializer.containsMessage
def (const self)
Returns true
if the serializer's buffer contains at least the
configured amount of bytes; otherwise returns false
.
Network.DataSerializer.isEmpty
def (const self)
Returns true
if the serializer's buffer is empty; otherwise
returns false
.
Network.DataSerializer.length
0
Internal fixed length.
Network.DataSerializer.new
def (self, length)
Creates a new serializer for messages of fixed length length
.
Network.DataSerializer.nextMessage
def (self)
Returns the next message in the serializer's buffer as an array of
uint8 with a length equal to the fixed length configured for this
serializer or none
if the buffer contains less than this configured
amount of bytes. The data used to create the message is then removed
from the buffer.
Network.DataSerializer.read
def (self, endpoint)
Attempts to read data from the end point. Returns true
if data was
receive; otherwise returns false
.
Network.DataSerializer.stream
null
Internal buffer.
Network.DataSerializer.write
def (self, endpoint)
Attempts to write data to the end point. Returns true
if the data
was successfully sent; otherwise returns false
. After this call,
the sent data is removed from the buffer.