org.refcodes.mixin.LengthAccessor
, Serializable
ArraySection<ARRAY>
, ArraySegment<SEGMENT>
, ArrayTransmission<ARRAY>
, DecoratorSection<DECORATEE>
, DecoratorSegment<DECORATEE>
, ErrorCorrectionTransmission
, PayloadSection<T>
, PayloadSegment<T>
, PayloadTransmission<T>
, ReadyToReceiveTransmission
, ReadyToSendTransmission
, Section
, Section.SectionMixin
, Segment
, Segment.SegmentMixin
, StopAndWaitPacketStreamTransmission
, StopAndWaitTransmission
, Transmission.TransmissionMixin
, TransmissionComposite<CHILD>
AbstractArrayTransmission
, AbstractCipherTransmissionDecorator
, AbstractCrcTransmissionDecorator
, AbstractErrorCorrectionTransmissionDecorator
, AbstractInvertibleTransmissionDecorator
, AbstractLengthDecoratorSegment
, AbstractMagicBytesTransmission
, AbstractMagicBytesTransmissionDecorator
, AbstractMagicBytesTransmissionDispatcher
, AbstractPayloadSection
, AbstractPayloadSegment
, AbstractReadyToReceiveTransmissionDecorator
, AbstractReadyToSendTransmissionDecorator
, AbstractReferenceeLengthSegment
, AbstractSectionDecorator
, AbstractSegmentDecorator
, AbstractStopAndWaitPacketStreamTransmissionDecorator
, AbstractStopAndWaitTransmissionDecorator
, AbstractTransmissionComposite
, AbstractTransmissionDecorator
, AllocSectionDecoratorSegment
, AllocSegmentBody
, AllocSegmentHead
, AsciizArraySegment
, AsciizSegment
, AssertMagicBytesSectionDecorator
, AssertMagicBytesSegment
, AssertMagicBytesSegmentDecorator
, BooleanArraySection
, BooleanSegment
, BreakerSectionDecorator
, BreakerSegmentDecorator
, ByteArraySection
, ByteSegment
, CharArraySection
, CharSection
, CipherSectionDecorator
, CipherSegmentDecorator
, ComplexTypeSegment
, CrcSectionDecorator
, CrcSegmentDecorator
, DoubleArraySection
, DoubleSegment
, DynamicTypeSegment
, FileSection
, FixedLengthSequenceSegment
, FixedSegmentArraySection
, FloatArraySection
, FloatSegment
, FullDuplexPacketPortDecorator.TransmissionSegment
, FullDuplexTxPortDecorator.TransmissionSegment
, IntArraySection
, IntSegment
, InvertibleSectionDecorator
, InvertibleSegmentDecorator
, LengthDecoratorSegment
, LengthSegmentDecoratorSegment
, LongArraySection
, LongSegment
, MagicBytesSectionDecorator
, MagicBytesSectionDispatcher
, MagicBytesSegment
, MagicBytesSegmentDecorator
, MagicBytesSegmentDispatcher
, NumberSegment
, PropertiesSection
, ReadyToReceiveSectionDecorator
, ReadyToReceiveSegmentDecorator
, ReadyToSendSectionDecorator
, ReadyToSendSegmentDecorator
, SectionComposite
, SegmentArraySection
, SegmentComposite
, SequenceNumberSegment
, SequenceSection
, ShortArraySection
, ShortSegment
, StopAndWaitPacketStreamSectionDecorator
, StopAndWaitPacketStreamSegmentDecorator
, StopAndWaitSectionDecorator
, StopAndWaitSegmentDecorator
, StringArraySection
, StringSection
, StringSegment
public interface Transmission extends org.refcodes.mixin.LengthAccessor, Serializable
Transmission
interface enables an implementing type to provide a
Sequence
representation of itself or to transmit its Sequence
representation through an OutputStream
(with an optional feedback
InputStream
) as of transmitTo(OutputStream, InputStream)
.
Usually, an implementation of the Transmission
interface actually
either implements the Segment
interface or the Section
interface which both share the Transmission
super-interface. (this
interface is Serializable
in order to achieve a deep copy the easy
way which is required by the ComplexTypeSegment
and the
FixedSegmentArraySection
).Modifier and Type | Interface | Description |
---|---|---|
static interface |
Transmission.TransmissionMixin |
Default implementation of the
Transmission interface providing an
implementation of the Transmission.TransmissionMixin.transmitTo(OutputStream, InputStream)
method using the toTransmission() method. |
Modifier and Type | Method | Description |
---|---|---|
static byte[] |
fromInputStream(InputStream aInputStream,
int aLength) |
Retrieves the number of bytes from the given
InputStream by also
trying to read the required number of bytes in chunks (in case not all
bytes can be read in one take). |
int |
getLength() |
Determines the overall length of this
Transmission . |
Schema |
toSchema() |
Retrieves the
Schema representing the Transmission . |
org.refcodes.struct.SimpleTypeMap |
toSimpleTypeMap() |
Returns the
SimpleTypeMap representation of this
Transmission . |
Sequence |
toTransmission() |
Provides the
Sequence representation of this
Transmission . |
default void |
transmitTo(OutputStream aOutputStream) |
Transmits the
Sequence representing the implementing type's
instance to the given OutputStream . |
void |
transmitTo(OutputStream aOutputStream,
InputStream aReturnStream) |
Transmits the
Sequence representing the implementing type's
instance to the given OutputStream . |
default void |
transmitTo(SerialTransceiver aSerialTransceiver) |
Transmits the
Sequence representing the implementing type's
instance to the given SerialTransceiver 's OutputStream . |
int getLength()
Transmission
. In case of
nested Transmission
instances, all length values from all
sub-segments are accumulated to the result as well.getLength
in interface org.refcodes.mixin.LengthAccessor
Transmission
(including any
sub-segments).Sequence toTransmission()
Sequence
representation of this
Transmission
. In case of nested Transmission
instances,
all Sequence
representations from all sub-segments are
accumulated to the result as well.Sequence
.default void transmitTo(OutputStream aOutputStream) throws IOException
Sequence
representing the implementing type's
instance to the given OutputStream
. This is a convenience method
in case there is no feedback InputStream
available (actually the
transmitTo(OutputStream, InputStream)
method is invoked with
null
for the feedback InputStream
). Override
transmitTo(OutputStream, InputStream)
for your custom
transmitting functionality.aOutputStream
- The OutputStream
where to write this
instance's Sequence
to.IOException
- thrown in case writing data to the
OutputStream
caused problems.default void transmitTo(SerialTransceiver aSerialTransceiver) throws IOException
Sequence
representing the implementing type's
instance to the given SerialTransceiver
's OutputStream
.
Implementations providing error correction methods use the provided
SerialTransceiver
's feedback InputStream
to do some sort
of "stop-and-wait ARQ" or apply similar methods to ensure correctness of
the transmitted data.This is a convenience method (actually the
transmitTo(OutputStream, InputStream)
method is invoked).
Override transmitTo(OutputStream, InputStream)
for your custom
transmitting functionality.aSerialTransceiver
- The SerialTransceiver
providing the
OutputStream
where to write this instance's
Sequence
to and providing the InputStream
being
the return channel to handle "stop-and-wait ARQ".IOException
- thrown in case writing data to the
OutputStream
caused problems.void transmitTo(OutputStream aOutputStream, InputStream aReturnStream) throws IOException
Sequence
representing the implementing type's
instance to the given OutputStream
. Implementations providing
error correction methods use the provided feedback InputStream
to
do some sort of "stop-and-wait ARQ" or apply similar methods to ensure
correctness of the transmitted data.aOutputStream
- The OutputStream
where to write this
instance's Sequence
to.aReturnStream
- An InputStream
being the return channel to
handle "stop-and-wait ARQ" or the like in case of a bidirectional
connection. Can be null in case we have a unidirectional
connection.IOException
- thrown in case writing data to the
OutputStream
caused problems.Schema toSchema()
Schema
representing the Transmission
.
Retrieving a Schema
is useful when analyzing and debugging data
structures such as a AllocSectionDecoratorSegment
instance to help
document, learn and verify on the structure (as well as the content) of
that very AllocSectionDecoratorSegment
.Schema
representation of the implementing type for
debugging and verification (or documentation) purposes.org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()
SimpleTypeMap
representation of this
Transmission
. In case this Transmission has Transmission
children, then the children are queried as well and contained in the
resulting SimpleTypeMap
. The aliases of the according
Transmission
instances represent the resulting path to a
Transmission
's final simple type.SimpleTypeMap
representing this Transmission
and (if any) its children, with the according aliases forming the
paths to the Transmission
's values.static byte[] fromInputStream(InputStream aInputStream, int aLength) throws IOException
InputStream
by also
trying to read the required number of bytes in chunks (in case not all
bytes can be read in one take).aInputStream
- The byte array data from which to retrieve the bytes.aLength
- The number of bytes to be retrieved.IOException
- thrown in case reading data from the
InputStream
caused problems.Copyright © 2021. All rights reserved.