- All Implemented Interfaces:
Serializable
,Comparable<MagicBytes>
,java.lang.constant.Constable
,org.refcodes.mixin.MagicBytesAccessor
,MagicBytesAccessor
The
MagicBytes
enumeration provides various predefined magic bytes
for common use cases. Some magic bytes may be combined using the
MagicBytesAccessor.toMagicBytes()
method to create magic bytes with more semantic
information.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
Nested classes/interfaces inherited from interface org.refcodes.serial.MagicBytesAccessor
MagicBytesAccessor.MagicBytesBuilder<B extends MagicBytesAccessor.MagicBytesBuilder<B>>, MagicBytesAccessor.MagicBytesMutator, MagicBytesAccessor.MagicBytesProperty
-
Enum Constant Summary
Enum ConstantDescriptionMagic bytes identifying a transmission acknowledge, same asAscii.ACK
.Identifies a request expecting an acknowledgeable response (acknowledge to be sent sent for the succeeding response).Identifies an acknowledgeable response in reply to a request (acknowledge to be sent for the response).Identifies an acknowledgeable transmission (acknowledge to be sent).Magic bytes identifying a Clear-to-Send transmission, same asAscii.ACK
.Magic bytes identifying a last transmission package, same asAscii.ETX
.Magic bytes identifying an transmission package, same asAscii.STX
.Identifies a simple ping request to be responded by a fire-and-forgetPONG
(not to be acknowledged).Identifies a a fire-and-forget pong (not to be acknowledged) reply in response to a simplePING
request.Magic bytes identifying a Ready-to-Receive transmission, same asAscii.ENQ
.Magic bytes identifying a Ready-to-Send transmission, same asAscii.ENQ
.Identifies a request expecting a fire-and-forget response (no acknowledge to be sent for the succeeding response).Sent when a request was received but dismissed by a receiver .Identifies a fire-and-forget response in reply to a request (no acknowledge to be sent for the response).Identifies an acknowledge in reply to a response.Identifies a fire-and-forget transmission (no acknowledge sent).Sent in case a transmission was received and dismissed by a receiver. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
static byte[]
toMagicBytes
(MagicBytes... aMagicBytes) Constructs magic bytes from the providedMagicBytes
elements to be concatenated to a single magic bytes sequence.static MagicBytes
Returns the enum constant of this type with the specified name.static MagicBytes[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Methods inherited from interface org.refcodes.serial.MagicBytesAccessor
toMagicBytes, toMagicBytes
-
Enum Constant Details
-
ACKNOWLEDGE
Magic bytes identifying a transmission acknowledge, same asAscii.ACK
. -
CLEAR_TO_SEND
Magic bytes identifying a Clear-to-Send transmission, same asAscii.ACK
. -
LAST_PACKET
Magic bytes identifying a last transmission package, same asAscii.ETX
. -
PACKET
Magic bytes identifying an transmission package, same asAscii.STX
. -
READY_TO_RECEIVE
Magic bytes identifying a Ready-to-Receive transmission, same asAscii.ENQ
. -
READY_TO_SEND
Magic bytes identifying a Ready-to-Send transmission, same asAscii.ENQ
. -
TRANSMISSION
Identifies a fire-and-forget transmission (no acknowledge sent). -
REQUEST
Identifies a request expecting a fire-and-forget response (no acknowledge to be sent for the succeeding response). -
RESPONSE
Identifies a fire-and-forget response in reply to a request (no acknowledge to be sent for the response). -
RESPONSE_ACKNOWLEDGE
Identifies an acknowledge in reply to a response. -
ACKNOWLEDGEABLE_TRANSMISSION
Identifies an acknowledgeable transmission (acknowledge to be sent). -
ACKNOWLEDGEABLE_REQUEST
Identifies a request expecting an acknowledgeable response (acknowledge to be sent sent for the succeeding response). -
ACKNOWLEDGEABLE_RESPONSE
Identifies an acknowledgeable response in reply to a request (acknowledge to be sent for the response). -
TRANSMISSION_DISMISSED
Sent in case a transmission was received and dismissed by a receiver. -
REQUEST_DISMISSED
Sent when a request was received but dismissed by a receiver . -
PING
Identifies a simple ping request to be responded by a fire-and-forgetPONG
(not to be acknowledged). -
PONG
Identifies a a fire-and-forget pong (not to be acknowledged) reply in response to a simplePING
request.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getMagicBytes
public byte[] getMagicBytes()- Specified by:
getMagicBytes
in interfaceorg.refcodes.mixin.MagicBytesAccessor
-
toMagicBytes
Constructs magic bytes from the providedMagicBytes
elements to be concatenated to a single magic bytes sequence.- Parameters:
aMagicBytes
- TheMagicBytes
elements from which to create the magic bytes.- Returns:
- The accordingly created magic bytes.
-