Class SerialDataEvent

    • Field Detail

      • hexArray

        protected static final char[] hexArray
    • Constructor Detail

      • SerialDataEvent

        public SerialDataEvent​(Serial serial)
        Default event constructor.
      • SerialDataEvent

        public SerialDataEvent​(Serial serial,
                               byte[] data)
        Default event constructor.
    • Method Detail

      • getSerial

        public Serial getSerial()
        Get the serial interface instance
        Returns:
        serial interface
      • getReader

        public SerialDataReader getReader()
        Get an instance of the serial data reader
        Returns:
        serial data reader interface
      • length

        public int length()
                   throws IOException
        Get the number of bytes available in the serial data
        Returns:
        number of bytes available
        Throws:
        IOException
      • getBytes

        public byte[] getBytes()
                        throws IOException
        Get all the bytes (byte-array) available in the serial data receive buffer
        Returns:
        byte array containing all bytes available in serial data receive buffer
        Throws:
        IOException
      • getByteBuffer

        public ByteBuffer getByteBuffer()
                                 throws IOException
        Get all the bytes (byte-buffer) available in the serial data receive buffer
        Returns:
        ByteBuffer containing all bytes available in serial data receive buffer
        Throws:
        IOException
      • getString

        public String getString​(Charset charset)
                         throws IOException
        Get a string representation of the bytes available in the serial data receive buffer
        Parameters:
        charset - the character-set used to construct the string from the underlying byte array
        Returns:
        string of data from serial data receive buffer
        Throws:
        IOException
      • getAsciiString

        public String getAsciiString()
                              throws IOException
        Get an ASCII string representation of the bytes available in the serial data receive buffer
        Returns:
        ASCII string of data from serial data receive buffer
        Throws:
        IOException
      • getHexByteString

        public String getHexByteString()
                                throws IOException
        Get a HEX string representation of the bytes available in the serial data receive buffer
        Returns:
        HEX string of comma separated data bytes from serial data receive buffer
        Throws:
        IOException
      • getHexByteString

        public String getHexByteString​(CharSequence prefix,
                                       CharSequence separator,
                                       CharSequence suffix)
                                throws IOException
        Get a HEX string representation of the bytes available in the serial data receive buffer
        Parameters:
        prefix - optional prefix string to append before each data byte
        separator - optional separator string to append in between each data byte sequence
        suffix - optional suffix string to append after each data byte
        Returns:
        HEX string of data bytes from serial data receive buffer
        Throws:
        IOException
      • getCharBuffer

        public CharBuffer getCharBuffer​(Charset charset)
                                 throws IOException
        Get a character buffer of the bytes available in the serial data receive buffer
        Parameters:
        charset - the character-set used to construct the character buffer from the underlying byte array
        Returns:
        CharBuffer of data from serial data receive buffer
        Throws:
        IOException