Class BaseEncoderImpl

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  BaseEncoderImpl.BaseEncoderConsumerImpl
      Vanilla plain implementation of the BaseEncoder.BaseEncoderConsumer interface to be used with ByteConsumer (ByteSender) instances.
      • 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
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected BaseEncoderImpl()
      Explicit default constructor.
        BaseEncoderImpl​(org.refcodes.io.ByteConsumer aByteConsumer)
      Constructs the BaseEncoder instance using the provided ByteConsumer to receive the encoded data.
        BaseEncoderImpl​(org.refcodes.io.ByteSender aByteSender)
      Constructs the BaseEncoder instance using the provided ByteSender to receive the encoded data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      void flush()
      BaseMetrics getBaseMetrics()
      Retrieves the base codec metrics from the base codec metrics property.
      protected void open​(org.refcodes.io.ByteConsumer aConnection)
      Open.
      void setBaseMetrics​(BaseMetrics aBaseMetrics)
      Sets the base codec metrics for the base codec metrics property.
      BaseEncoder withBaseMetrics​(BaseMetrics _baseCodecMetrics)
      Sets the base codec metrics for the base codec metrics property.
      void writeDatagram​(byte aDatagram)
      void writeDatagrams​(byte[] aDatagram)
      void writeDatagrams​(byte[] aDatagram, int aOffset, int aLength)
      • Methods inherited from class org.refcodes.component.AbstractConnectableAutomaton

        getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
      • 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, isConnectionOpened
      • Methods inherited from interface org.refcodes.component.Flushable

        flushUnchecked, isFlushable
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.refcodes.component.OpenedAccessor

        isOpened
    • Constructor Detail

      • BaseEncoderImpl

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

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

        protected BaseEncoderImpl()
        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.
      • writeDatagram

        public void writeDatagram​(byte aDatagram)
                           throws org.refcodes.component.OpenException
        Specified by:
        writeDatagram in interface org.refcodes.io.ByteConsumer
        Specified by:
        writeDatagram in interface org.refcodes.io.ByteDatagramConsumer
        Throws:
        org.refcodes.component.OpenException
      • writeDatagrams

        public void writeDatagrams​(byte[] aDatagram)
                            throws org.refcodes.component.OpenException
        Specified by:
        writeDatagrams in interface org.refcodes.io.ByteBlockConsumer
        Specified by:
        writeDatagrams in interface org.refcodes.io.ByteConsumer
        Throws:
        org.refcodes.component.OpenException
      • writeDatagrams

        public void writeDatagrams​(byte[] aDatagram,
                                   int aOffset,
                                   int aLength)
                            throws org.refcodes.component.OpenException
        Specified by:
        writeDatagrams in interface org.refcodes.io.ByteBlockConsumer
        Specified by:
        writeDatagrams in interface org.refcodes.io.ByteSender
        Throws:
        org.refcodes.component.OpenException
      • flush

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

        public void close()
                   throws org.refcodes.component.CloseException
        Specified by:
        close in interface org.refcodes.component.Closable
        Overrides:
        close in class org.refcodes.component.AbstractConnectableAutomaton
        Throws:
        org.refcodes.component.CloseException
      • open

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