Interface Section.SectionMixin

All Superinterfaces:
org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.Resetable, org.refcodes.mixin.Schemable, Section, Serializable, Transmission, Transmission.TransmissionMixin
All Known Subinterfaces:
ArraySection<ARRAY>
All Known Implementing Classes:
AbstractPayloadSection, AssertMagicBytesSectionDecorator, BooleanArraySection, ByteArraySection, CharArraySection, CharSection, DoubleArraySection, DynamicTypeSection, FileSection, FixedSegmentArraySection, FloatArraySection, IntArraySection, LongArraySection, MagicBytesSectionDecorator, PropertiesSection, SectionComposite, SegmentArraySection, SequenceSection, ShortArraySection, StringArraySection, StringSection
Enclosing interface:
Section

public static interface Section.SectionMixin extends Transmission.TransmissionMixin, Section
Default implementation of the Section interface providing an implementation of the receiveFrom(InputStream, int, OutputStream) method using the Section.fromTransmission(Sequence, int) method or the Section.fromTransmission(Sequence, int, int) method..
  • Method Details

    • receiveFrom

      default void receiveFrom(InputStream aInputStream, int aLength, OutputStream aReturnStream) throws IOException
      Default implementation harnessing the Section.fromTransmission(Sequence, int) method. (Re-)initializes this instance by receiving the according Sequence from the given InputStream. Implementations providing error correction methods use the provided feedback OutputStream to do some sort of "stop-and-wait ARQ" or apply similar methods to ensure correctness of the received data.
      Specified by:
      receiveFrom in interface Section
      Parameters:
      aInputStream - The InputStream from which to read the instance's (re-)initialization Sequence from.
      aLength - The length of data assigned by the byte array.
      aReturnStream - An OutputStream 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.
      Throws:
      IOException - thrown in case reading data from the InputStream caused problems.
      TransmissionException - thrown in case a given InputStream bytes cannot be processed.