Class BaseEncoder

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  BaseEncoder.BaseEncoderConnection
      The BaseEncoder.BaseEncoderConnection implements the BaseEncoder functionality in terms of a ConnectionComponent.
      • Nested classes/interfaces inherited from interface org.refcodes.io.BytesTransmitter

        org.refcodes.io.BytesTransmitter.TransmitterOutputStream
      • Nested classes/interfaces inherited from interface org.refcodes.component.Closable

        org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor

        org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent

        org.refcodes.component.ConnectableComponent.ConnectableAutomaton
      • Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor

        org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
      • Nested classes/interfaces inherited from interface org.refcodes.component.Flushable

        org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor

        org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
      • Nested classes/interfaces inherited from interface org.refcodes.mixin.OutputStreamAccessor

        org.refcodes.mixin.OutputStreamAccessor.OutputStreamBuilder<B extends org.refcodes.mixin.OutputStreamAccessor.OutputStreamBuilder<?>>, org.refcodes.mixin.OutputStreamAccessor.OutputStreamMutator, org.refcodes.mixin.OutputStreamAccessor.OutputStreamProperty
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BaseEncoder()
      Explicit default constructor.
        BaseEncoder​(OutputStream aOutputStream)
      Constructs the BaseEncoder instance using the provided OutputStream to receive the encoded data.
        BaseEncoder​(OutputStream aOutputStream, BaseMetrics aBaseMetrics)
      Constructs the BaseEncoder instance using the provided OutputStream to receive the encoded data.
        BaseEncoder​(org.refcodes.io.BytesSource aByteConsumer)
      Constructs the BaseEncoder instance using the provided BytesSource to receive the encoded data.
        BaseEncoder​(org.refcodes.io.BytesTransmitter aByteSender)
      Constructs the BaseEncoder instance using the provided BytesTransmitter to receive the encoded data.
        BaseEncoder​(org.refcodes.io.OutputStreamBytesTransmitter aOutputStreamBytesTransmitter, BaseMetrics aBaseMetrics)
      Constructs the BaseEncoder instance using the provided OutputStreamBytesTransmitter to receive the encoded data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Make sure to call close() when done as the final padding bytes are appended to the end!
      void flush()
      BaseMetrics getBaseMetrics()
      Retrieves the base codec metrics from the base codec metrics property.
      protected void open​(org.refcodes.io.BytesSource aConnection)
      Open.
      void setBaseMetrics​(BaseMetrics aBaseMetrics)
      Sets the base codec metrics for the base codec metrics property.
      void transmitAllBytes​(byte[] aDatagram)
      void transmitByte​(byte aByte)
      void transmitBytes​(byte[] aDatagram, int aOffset, int aLength)
      BaseEncoder withBaseMetrics​(BaseMetrics aBaseMetrics)
      Sets the base codec metrics for the base codec metrics property.
      • Methods inherited from class org.refcodes.component.AbstractConnectableAutomaton

        getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
      • Methods inherited from interface org.refcodes.io.BytesTransmitter

        getOutputStream
      • Methods inherited from interface org.refcodes.component.Closable

        closeIn, closeQuietly, closeUnchecked
      • Methods inherited from interface org.refcodes.component.Closable.CloseAutomaton

        isClosable
      • Methods inherited from interface org.refcodes.component.ClosedAccessor

        isClosed
      • Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor

        getConnectionStatus, isOpened
      • Methods inherited from interface org.refcodes.component.Flushable

        flushUnchecked, isFlushable
    • Constructor Detail

      • BaseEncoder

        public BaseEncoder​(org.refcodes.io.BytesSource aByteConsumer)
        Constructs the BaseEncoder instance using the provided BytesSource to receive the encoded data.
        Parameters:
        aByteConsumer - The BytesSource to be fed with the encoded data.
      • BaseEncoder

        public BaseEncoder​(org.refcodes.io.BytesTransmitter aByteSender)
                    throws IOException
        Constructs the BaseEncoder instance using the provided BytesTransmitter to receive the encoded data.
        Parameters:
        aByteSender - The BytesTransmitter to be fed with the encoded data.
        Throws:
        IOException - in case opening or accessing an open line (connection, junction, link) caused problems.
      • BaseEncoder

        public BaseEncoder​(org.refcodes.io.OutputStreamBytesTransmitter aOutputStreamBytesTransmitter,
                           BaseMetrics aBaseMetrics)
                    throws IOException
        Constructs the BaseEncoder instance using the provided OutputStreamBytesTransmitter to receive the encoded data.
        Parameters:
        aOutputStreamBytesTransmitter - The OutputStreamBytesTransmitter to use.
        aBaseMetrics - The BaseMetrics to use.
        Throws:
        IOException - in case opening or accessing an open line (connection, junction, link) caused problems.
      • BaseEncoder

        protected BaseEncoder()
        Explicit default constructor.
    • Method Detail

      • getBaseMetrics

        public BaseMetrics getBaseMetrics()
        Retrieves the base codec metrics from the base codec metrics property.
        Specified by:
        getBaseMetrics in interface BaseMetricsAccessor
        Returns:
        The base codec metrics stored by the base codec metrics property.
      • transmitByte

        public void transmitByte​(byte aByte)
                          throws IOException
        Specified by:
        transmitByte in interface org.refcodes.io.ByteSource
        Specified by:
        transmitByte in interface org.refcodes.io.BytesSource
        Throws:
        IOException
      • transmitAllBytes

        public void transmitAllBytes​(byte[] aDatagram)
                              throws IOException
        Specified by:
        transmitAllBytes in interface org.refcodes.io.BytesSource
        Throws:
        IOException
      • transmitBytes

        public void transmitBytes​(byte[] aDatagram,
                                  int aOffset,
                                  int aLength)
                           throws IOException
        Specified by:
        transmitBytes in interface org.refcodes.io.BytesSource
        Specified by:
        transmitBytes in interface org.refcodes.io.BytesTransmitter
        Throws:
        IOException
      • flush

        public void flush()
                   throws IOException
        Specified by:
        flush in interface org.refcodes.io.ByteTransmitter
        Specified by:
        flush in interface Flushable
        Specified by:
        flush in interface org.refcodes.component.Flushable
        Throws:
        IOException
      • close

        public void close()
                   throws IOException
        Make sure to call close() when done as the final padding bytes are appended to the end!
        Specified by:
        close in interface org.refcodes.component.Closable
        Overrides:
        close in class org.refcodes.component.AbstractConnectableAutomaton
        Throws:
        IOException
      • open

        protected void open​(org.refcodes.io.BytesSource aConnection)
                     throws IOException
        Open.
        Parameters:
        aConnection - the connection
        Throws:
        IOException - the open exception