Class SerialP2PHeader

  • All Implemented Interfaces:
    Serializable, org.refcodes.mixin.DestinationAccessor<Integer>, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.MagicBytesAccessor, org.refcodes.mixin.MagicNumberAccessor<Integer>, org.refcodes.p2p.P2PHeader<Integer>, org.refcodes.serial.Segment, org.refcodes.serial.Segment.SegmentMixin, org.refcodes.serial.Transmission, org.refcodes.serial.Transmission.TransmissionMixin

    public class SerialP2PHeader
    extends org.refcodes.p2p.AbstractP2PHeader<Integer>
    implements org.refcodes.mixin.MagicNumberAccessor<Integer>, org.refcodes.p2p.P2PHeader<Integer>, org.refcodes.mixin.MagicBytesAccessor, org.refcodes.serial.Segment, org.refcodes.serial.Segment.SegmentMixin
    The SerialP2PHeader represents a P2PHeader optimized for local microcontroller wiring (networks) and microcontroller memory layout: The visited hops are serialized and deserialized in the tail of the SerialP2PMessage as this makes append the last hop easier for devices with small memory buffers.
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.mixin.DestinationAccessor

        org.refcodes.mixin.DestinationAccessor.DestinationMutator<DEST extends Object>, org.refcodes.mixin.DestinationAccessor.DestinationProperty<DEST 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.LengthProperty
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.MagicBytesAccessor

        org.refcodes.mixin.MagicBytesAccessor.MagicBytesBuilder<B extends org.refcodes.mixin.MagicBytesAccessor.MagicBytesBuilder<B>>, org.refcodes.mixin.MagicBytesAccessor.MagicBytesMutator, org.refcodes.mixin.MagicBytesAccessor.MagicBytesProperty
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.MagicNumberAccessor

        org.refcodes.mixin.MagicNumberAccessor.MagicNumberBuilder<T extends Object,​B extends org.refcodes.mixin.MagicNumberAccessor.MagicNumberBuilder<T,​B>>, org.refcodes.mixin.MagicNumberAccessor.MagicNumberMutator<T extends Object>, org.refcodes.mixin.MagicNumberAccessor.MagicNumberProperty<T extends Object>
      • Nested classes/interfaces inherited from interface org.refcodes.serial.Segment

        org.refcodes.serial.Segment.SegmentMixin
      • Nested classes/interfaces inherited from interface org.refcodes.serial.Transmission

        org.refcodes.serial.Transmission.TransmissionMixin
    • Field Summary

      • Fields inherited from class org.refcodes.p2p.AbstractP2PHeader

        _destination
    • Method Detail

      • getMagicBytes

        public byte[] getMagicBytes()
        Specified by:
        getMagicBytes in interface org.refcodes.mixin.MagicBytesAccessor
      • getMagicNumber

        public Integer getMagicNumber()
        Specified by:
        getMagicNumber in interface org.refcodes.mixin.MagicNumberAccessor<Integer>
      • getLength

        public int getLength()
        Specified by:
        getLength in interface org.refcodes.mixin.LengthAccessor
        Specified by:
        getLength in interface org.refcodes.serial.Transmission
      • toSequence

        public org.refcodes.serial.Sequence toSequence()
        Specified by:
        toSequence in interface org.refcodes.serial.Transmission
      • transmitTo

        public void transmitTo​(OutputStream aOutputStream,
                               InputStream aReturnStream)
                        throws IOException
        Specified by:
        transmitTo in interface org.refcodes.serial.Transmission
        Specified by:
        transmitTo in interface org.refcodes.serial.Transmission.TransmissionMixin
        Throws:
        IOException
      • toSchema

        public org.refcodes.serial.Schema toSchema()
        Specified by:
        toSchema in interface org.refcodes.serial.Transmission
      • toSimpleTypeMap

        public org.refcodes.struct.SimpleTypeMap toSimpleTypeMap()
        Specified by:
        toSimpleTypeMap in interface org.refcodes.serial.Transmission
      • fromTransmission

        public int fromTransmission​(org.refcodes.serial.Sequence aSequence,
                                    int aOffset)
                             throws org.refcodes.serial.TransmissionException
        Specified by:
        fromTransmission in interface org.refcodes.serial.Segment
        Throws:
        org.refcodes.serial.TransmissionException
      • receiveFrom

        public void receiveFrom​(InputStream aInputStream,
                                OutputStream aReturnStream)
                         throws IOException,
                                org.refcodes.serial.TransmissionException
        Specified by:
        receiveFrom in interface org.refcodes.serial.Segment
        Specified by:
        receiveFrom in interface org.refcodes.serial.Segment.SegmentMixin
        Throws:
        IOException
        org.refcodes.serial.TransmissionException