Class UARTInputStream

    • Constructor Detail

      • UARTInputStream

        public UARTInputStream​(UART uart)
        Creates an input stream on a given UART interface.
        Parameters:
        uart - UART number.
    • Method Detail

      • available

        public int available()
        Returns the number of bytes available from the stream.
        Overrides:
        available in class InputStream
        Returns:
        number of bytes available.
      • read

        public int read()
        Reads one byte from the UART. A call of this method is not blocking!
        Specified by:
        read in class InputStream
        Returns:
        byte read
      • read

        public int read​(byte[] buffer)
        Reads the given number of bytes from the UART. A call of this method is not blocking!
        Overrides:
        read in class InputStream
        Parameters:
        buffer - Byte array to write the received data.
        Returns:
        the number of bytes read.
      • read

        public int read​(byte[] buffer,
                        int off,
                        int count)
        Reads the given number of bytes from the UART. A call of this method is not blocking!
        Overrides:
        read in class InputStream
        Parameters:
        buffer - Byte array to write the received data.
        off - Offset in the array to start writing the data.
        count - Length (number of bytes) to read.
        Returns:
        the number of bytes read.