Module org.refcodes.serial
Package org.refcodes.serial
Class SegmentComposite<CHILD extends Segment>
java.lang.Object
org.refcodes.serial.AbstractTransmissionComposite<CHILD>
org.refcodes.serial.SegmentComposite<CHILD>
- Type Parameters:
CHILD- The type of the child elements to be contained in this instance.
- All Implemented Interfaces:
Serializable,Iterable<CHILD>,org.refcodes.mixin.ChildrenAccessor<CHILD[]>,org.refcodes.mixin.LengthAccessor,org.refcodes.mixin.Schemable<SerialSchema>,Segment,Segment.SegmentMixin,Transmission,Transmission.TransmissionMixin,TransmissionComposite<CHILD>
- Direct Known Subclasses:
ComplexTypeSegment
public class SegmentComposite<CHILD extends Segment>
extends AbstractTransmissionComposite<CHILD>
implements Segment, Segment.SegmentMixin, TransmissionComposite<CHILD>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.mixin.ChildrenAccessor
org.refcodes.mixin.ChildrenAccessor.ChildrenBuilder<T extends Object,B extends org.refcodes.mixin.ChildrenAccessor.ChildrenBuilder<T, B>>, org.refcodes.mixin.ChildrenAccessor.ChildrenMutator<T extends Object>, org.refcodes.mixin.ChildrenAccessor.ChildrenProperty<T extends Object> 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 -
Field Summary
Fields inherited from class org.refcodes.serial.AbstractTransmissionComposite
_children -
Constructor Summary
ConstructorsConstructorDescriptionSegmentComposite(CHILD... aSegments) SegmentComposite(Collection<CHILD> aSegments) -
Method Summary
Modifier and TypeMethodDescriptionbooleanintfromTransmission(Sequence aSequence, int aOffset) (Re-)initializes this instance with the the givenSequencedata.inthashCode()voidreceiveFrom(InputStream aInputStream, OutputStream aReturnStream) (Re-)initializes this instance by receiving the accordingSequencefrom the givenInputStream.toSchema()Retrieves theSerialSchemarepresenting theTransmission.toString()Methods inherited from class org.refcodes.serial.AbstractTransmissionComposite
getChildren, iteratorMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.refcodes.mixin.ChildrenAccessor
getChildrenMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.refcodes.serial.Segment
fromTransmission, fromTransmission, fromTransmission, receiveFrom, receiveFromMethods inherited from interface org.refcodes.serial.Transmission
transmitTo, transmitToMethods inherited from interface org.refcodes.serial.Transmission.TransmissionMixin
transmitToMethods inherited from interface org.refcodes.serial.TransmissionComposite
getLength, toSequence, toSimpleTypeMap
-
Constructor Details
-
SegmentComposite
-
SegmentComposite
-
-
Method Details
-
fromTransmission
(Re-)initializes this instance with the the givenSequencedata.- Specified by:
fromTransmissionin interfaceSegment- Parameters:
aSequence- TheSequencedata from which to (re-)initialize this instance.aOffset- The offset where to start processing the providedSequence.- Returns:
- The index after the last offset into the given
Sequenceprocessed by this method. - Throws:
TransmissionException- thrown in case a givenSequencecannot be processed.
-
receiveFrom
public void receiveFrom(InputStream aInputStream, OutputStream aReturnStream) throws IOException, TransmissionException (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- Specified by:
receiveFromin interfaceSegment.SegmentMixin- 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.
-
toSchema
Retrieves theSerialSchemarepresenting theTransmission. Retrieving aSerialSchemais useful when analyzing and debugging data structures such as aAllocSectionDecoratorSegmentinstance to help document, learn and verify on the structure (as well as the content) of that veryAllocSectionDecoratorSegment.- Specified by:
toSchemain interfaceorg.refcodes.mixin.Schemable<CHILD extends Segment>- Specified by:
toSchemain interfaceTransmission- Specified by:
toSchemain interfaceTransmissionComposite<CHILD extends Segment>- Returns:
- The
SerialSchemarepresentation of the implementing type for debugging and verification (or documentation) purposes.
-
hashCode
public int hashCode() -
equals
-
toString
- Overrides:
toStringin classAbstractTransmissionComposite<CHILD extends Segment>
-