object PacketCodec
A packet codec defines how the translation between Java objects
and OSC atoms is accomplished. For example, by default, when
an OSC message is assembled for transmission, the encoder will
translate ajava.lang.Integer
argument into
a four byte integer with typetag 'i'
. Or when
a received message is being decoded, finding an atom typetagged
'f'
, the decoder will create a java.lang.Float
out of it.
This example sounds trivial, but the codec is also able to handle
type conversions. For instance, in the strict OSC 1.0 specification,
only 32bit numeric atoms are defined ('i'
and 'f'
).
A codec with mode MODE_STRICT_V1
will reject a
java.lang.Double
in the encoding process and not be
able to decode a typetag 'd'
. A codec with mode
MODE_MODEST
automatically breaks down everything the 32bit,
so a java.lang.Double
gets encoded as 32bit 'f'
and a received atom tagged 'd'
becomes a
java.lang.Float
. Other configurations exist.
Another important function of the codec is to specify the charset encoding
of strings, something that was overseen in the OSC 1.0 spec. By default,
UTF-8
is used so all special characters can be safely encoded.
Last but not least, using the putDecoder
and putEncoder
methods, the codec can be extended to support additional Java classes or
OSC typetags, without the need to subclass PacketCodec
.
- Alphabetic
- By Inheritance
- PacketCodec
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final case class BufferOverflow(message: String, cause: Throwable) extends Exception with Product with Serializable
An exception thrown during encoding or decoding, indicating that the buffer is too small to encode that packet.
- sealed trait Builder extends AnyRef
- sealed abstract class Exception extends IOException
- final case class MalformedPacket(name: String) extends Exception with Product with Serializable
An exception thrown during decoding, indicating that the received packet is malformed and does not comply with the OSC standard.
- final case class UnsupportedAtom(name: String) extends Exception with Product with Serializable
An exception thrown during encoding or decoding, indicating that no atom exists to encode or decode a particular type.
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
- def apply(): Builder
Creates a new codec builder, initialized to strict OSC 1_0 spec.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- implicit def build(b: Builder): PacketCodec
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final val default: PacketCodec
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- 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() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated