Class AbstractByteReceiver

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  AbstractByteReceiver.ConnectableAutomaton
      The Class ConnectableAutomaton.
      • 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.ConnectionStatusAccessor

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

        org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractByteReceiver()
      Constructs a AbstractByteReceiver with a default sized blocking queue enabling a maximum of AbstractByteProvider.DATAGRAM_QUEUE_SIZE datagrams. ------------------------------------------------------------------------- Make sure your code fetches the datagrams quick enough to prevent filling up of the queue.
      AbstractByteReceiver​(int aCapacity)
      Constructs a AbstractByteReceiver with a custom sized blocking queue enabling a maximum of datagrams as specified by the capacity parameter. ------------------------------------------------------------------------- Make sure your code fetches the datagrams quick enough to prevent filling up of the queue.
    • Constructor Detail

      • AbstractByteReceiver

        public AbstractByteReceiver​(int aCapacity)
        Constructs a AbstractByteReceiver with a custom sized blocking queue enabling a maximum of datagrams as specified by the capacity parameter. ------------------------------------------------------------------------- Make sure your code fetches the datagrams quick enough to prevent filling up of the queue. In case the queue is filled up, adding elements via AbstractByteProvider.pushDatagram(byte) to the queue is blocked until elements are taken from the queue via readDatagram().
        Parameters:
        aCapacity - The capacity of the queue holding the received datagrams.
    • Method Detail

      • hasDatagram

        public boolean hasDatagram()
                            throws org.refcodes.component.OpenException
        Determines whether a datagram is available from a DatagramSender. Use the DatagramProvider extenison's DatagramProvider.readDatagram() method for retrieving the available datagram.
        Specified by:
        hasDatagram in interface Receivable
        Returns:
        True in case there is a datagram ready to be retrieved .
        Throws:
        org.refcodes.component.OpenException - Thrown in case opening or accessing an open line (connection, junction, link) caused problems.
      • close

        public void close()
                   throws org.refcodes.component.CloseException
        Specified by:
        close in interface org.refcodes.component.Closable
        Throws:
        org.refcodes.component.CloseException
      • releaseAll

        public void releaseAll()
        Specified by:
        releaseAll in interface org.refcodes.mixin.Releaseable
      • isOpened

        public boolean isOpened()
        Specified by:
        isOpened in interface org.refcodes.component.OpenedAccessor
      • isClosable

        public boolean isClosable()
        Specified by:
        isClosable in interface org.refcodes.component.Closable.CloseAutomaton
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface org.refcodes.component.ClosedAccessor
      • getConnectionStatus

        public org.refcodes.component.ConnectionStatus getConnectionStatus()
        Specified by:
        getConnectionStatus in interface org.refcodes.component.ConnectionStatusAccessor
      • open

        protected void open()
                     throws org.refcodes.component.OpenException
        Open.
        Throws:
        org.refcodes.component.OpenException - the open exception
      • setConnectionStatus

        protected void setConnectionStatus​(org.refcodes.component.ConnectionStatus aConnectionStatus)
        Sets the connection status.
        Parameters:
        aConnectionStatus - the new connection status
      • isOpenable

        protected boolean isOpenable()
        Checks if is openable.
        Returns:
        true, if is openable