Class AbstractByteProvider

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected LinkedBlockingQueue<Byte> _datagramQueue  
      static int DATAGRAM_QUEUE_SIZE  
      • Fields inherited from interface org.refcodes.mixin.Loggable

        RUNTIME_LOGGER_CLASS, RUNTIME_LOGGER_FACTORY_CLASS, RUNTIME_LOGGER_FACTORY_METHOD
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractByteProvider​()
      Constructs a AbstractByteProvider with a default sized blocking queue enabling a maximum of DATAGRAM_QUEUE_SIZE datagrams. ------------------------------------------------------------------------- Make sure your code fetches the datagrams quick enough to prevent filling up of the queue.
      AbstractByteProvider​(int aCapacity)
      Constructs a AbstractByteProvider 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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void pushDatagram​(byte aDatagram)
      Pushes a datagram into the receiver and puts it into the blocking queue containing the so far received datagrams.
      protected void pushDatagrams​(byte[] aDatagrams)
      Pushes datagrams into the receiver and puts them into the blocking queue containing the so far received datagrams.
      protected void pushDatagrams​(byte[] aDatagrams, int aOffset, int aLength)
      Pushes datagrams into the receiver and puts them into the blocking queue containing the so far received datagrams.
      byte readDatagram​()
      Reads (receives) the next byte passed from a DatagramSender counterpart.
      byte[] readDatagrams​()
      Caution: Reads till an OpenException (or an InterruptedException in case of blocking till more data is available) occurs.
      byte[] readDatagrams​(int aBlockSize)
      Similar to ByteBlockProvider.readDatagrams() though at maximum the amount of data as provided by the block-size is returned.
      • Methods inherited from interface org.refcodes.mixin.Loggable

        alert, alert, critical, critical, debug, error, info, notice, panic, trace, warn, warn
    • Constructor Detail

      • AbstractByteProvider

        public AbstractByteProvider​()
        Constructs a AbstractByteProvider with a default sized blocking queue enabling a maximum of DATAGRAM_QUEUE_SIZE datagrams. ------------------------------------------------------------------------- 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 pushDatagram(byte) to the queue is blocked until elements are taken from the queue via readDatagram().
      • AbstractByteProvider

        public AbstractByteProvider​(int aCapacity)
        Constructs a AbstractByteProvider 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 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

      • pushDatagram

        protected void pushDatagram​(byte aDatagram)
                             throws org.refcodes.component.OpenException
        Pushes a datagram into the receiver and puts it into the blocking queue containing the so far received datagrams. Them datagrams can be retrieved via readDatagram(): Use AbstractByteReceiver extension's AbstractByteReceiver.hasDatagram() to test beforehand whether there is a datagram available.
        Parameters:
        aDatagram - The datagram to be pushed at the end of the blocking queue; to be retrieved with the readDatagram() method.
        Throws:
        org.refcodes.component.OpenException - the open exception
      • pushDatagrams

        protected void pushDatagrams​(byte[] aDatagrams)
                              throws org.refcodes.component.OpenException
        Pushes datagrams into the receiver and puts them into the blocking queue containing the so far received datagrams. Them datagrams can be retrieved via readDatagram(): Use AbstractByteReceiver extension's AbstractByteReceiver.hasDatagram() to test beforehand whether there is a datagram available.
        Parameters:
        aDatagrams - The datagrams to be pushed at the end of the blocking queue; to be retrieved with the readDatagram() method.
        Throws:
        org.refcodes.component.OpenException - the open exception
      • pushDatagrams

        protected void pushDatagrams​(byte[] aDatagrams,
                                     int aOffset,
                                     int aLength)
                              throws org.refcodes.component.OpenException
        Pushes datagrams into the receiver and puts them into the blocking queue containing the so far received datagrams. Them datagrams can be retrieved via readDatagram(): Use AbstractByteReceiver extension's AbstractByteReceiver.hasDatagram() to test beforehand whether there is a datagram available.
        Parameters:
        aDatagrams - The datagrams to be pushed at the end of the blocking queue; to be retrieved with the readDatagram() method.
        aOffset - The offset to start taking data from to be pushed.
        aLength - The number of elements to be pushed from the offset onwards.
        Throws:
        org.refcodes.component.OpenException - the open exception