- All Superinterfaces:
org.refcodes.mixin.LengthAccessor,org.refcodes.mixin.Resetable,org.refcodes.schema.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
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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.LengthAccessor
org.refcodes.mixin.LengthAccessor.LengthBuilder<B extends org.refcodes.mixin.LengthAccessor.LengthBuilder<B>>, org.refcodes.mixin.LengthAccessor.LengthMutator, org.refcodes.mixin.LengthAccessor.LengthPropertyNested classes/interfaces inherited from interface org.refcodes.serial.Segment
Segment.SegmentMixinNested classes/interfaces inherited from interface org.refcodes.serial.Transmission
Transmission.TransmissionMixin -
Method Summary
Modifier and TypeMethodDescriptiondefault voidreceiveFrom(InputStream aInputStream, OutputStream aReturnStream) Default implementation harnessing theSegment.fromTransmission(Sequence)method.Methods inherited from interface org.refcodes.serial.Segment
fromTransmission, fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFromMethods inherited from interface org.refcodes.serial.Transmission
getLength, reset, toSchema, toSequence, toSimpleTypeMap, transmitTo, transmitToMethods inherited from interface org.refcodes.serial.Transmission.TransmissionMixin
transmitTo
-
Method Details
-
receiveFrom
Default implementation harnessing theSegment.fromTransmission(Sequence)method. (Re-)initializes this instance by receiving the accordingSequencefrom the givenInputStream. Implementations providing error correction methods use the provided feedbackOutputStreamto do some sort of "stop-and-wait ARQ" or apply similar methods to ensure correctness of the received data.- Specified by:
receiveFromin interfaceSegment- Parameters:
aInputStream- TheInputStreamfrom which to read the instance's (re-)initializationSequencefrom.aReturnStream- AnOutputStreambeing 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 theInputStreamcaused problems.TransmissionException- thrown in case a given transmission cannot be processed.
-