The character set used to encode and decode strings.
The character set used to encode and decode strings. Unfortunately, this has not been specified in the OSC standard. We recommend to either restrict characters to 7-bit ascii range or to use UTF-8. The default implementation initially uses UTF-8.
Creates a new packet decoded from the ByteBuffer.
Creates a new packet decoded
from the ByteBuffer. This method tries
to read a null terminated string at the
beginning of the provided buffer. If it
equals the bundle identifier, the
decode
of Bundle
is called (which may recursively decode
nested bundles), otherwise the one from
Message
.
This method is final. For messages encountered,
decodeMessage
is called, , thus for
implementations of PacketCodec
, it is sufficient
to overwrite decodeMessage
.
ByteBuffer
pointing right at
the beginning of the packet. the buffer's
limited should be set appropriately to
allow the complete packet to be read. when
the method returns, the buffer's position
is right after the end of the packet.
new decoded OSC packet
Decodes a message with a given name and buffer holding its arguments.
Decodes a message with a given name and buffer holding its arguments.
Implementations should be careful to
catch potential instances of BufferUnderflowException
or other runtime exception such as IllegalArgumentException
and cast them into instances of PacketCodec.Exception
,
such that the caller can be safe to catch any error by
matching against PacketCodec.Exception
.
the name of the message which has already been decoded when this method is called.
the buffer, positioned at the type tags
list (beginning with ','
).
Encodes the given bundle
into the provided ByteBuffer
,
beginning at the buffer's current position.
Encodes the given bundle
into the provided ByteBuffer
,
beginning at the buffer's current position. To write the
encoded packet, you will typically call flip()
on the buffer, then write()
on the channel.
ByteBuffer
pointing right at
the beginning of the osc packet.
buffer position will be right after the end
of the packet when the method returns.
Encodes the message onto the given ByteBuffer
,
beginning at the buffer's current position.
Encodes the message onto the given ByteBuffer
,
beginning at the buffer's current position. To write the
encoded message, you will typically call flip()
on the buffer, then write()
on the channel.
ByteBuffer
pointing right at
the beginning of the osc packet.
buffer position will be right after the end
of the message when the method returns.
Calculates the byte size of the encoded bundle.
Calculates the byte size of the encoded bundle. This method is final. The size is the sum of the bundle name, its timetag and the sizes of each bundle element.
For contained messages,
encodedMessageSize
will be called, thus for
implementations of PacketCodec
, it is sufficient
to overwrite encodedMessageSize
.
Calculates the byte size of the encoded message
Calculates the byte size of the encoded message
the size of the OSC message in bytes
Prints a textual representation of the given atom to the given print stream.
Prints a textual representation of the given atom to the given print stream. Implementations should use the atom encoder suitable for the given value.
the atom to encode
the stream to print on
should only be used if the printing requires line breaks. Indentation should be 2x nestCount space characters.