Interface Segment.SegmentMixin

All Superinterfaces:
org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.Resetable, org.refcodes.mixin.Schemable, Segment, Serializable, Transmission, Transmission.TransmissionMixin
All Known Subinterfaces:
ArraySegment<SEGMENT>
All Known Implementing Classes:
AbstractPayloadSegment, AsciizArraySegment, AsciizSegment, AssertMagicBytesSegment, AssertMagicBytesSegmentDecorator, BooleanSegment, ByteSegment, ComplexTypeSegment, DoubleSegment, EnumSegment, FixedLengthSequenceSegment, FloatSegment, IntSegment, LongSegment, MagicBytesSegment, MagicBytesSegmentDecorator, NumberSegment, SegmentComposite, SequenceNumberSegment, ShortSegment
Enclosing interface:
Segment

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

    • receiveFrom

      default void receiveFrom(InputStream aInputStream, OutputStream aReturnStream) throws IOException
      Default implementation harnessing the Segment.fromTransmission(Sequence) 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 Segment
      Parameters:
      aInputStream - The InputStream from which to read the instance's (re-)initialization Sequence from.
      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 transmission cannot be processed.