Class JabbixReader


  • public class JabbixReader
    extends java.lang.Object
    A stream reader implementing the base Jabbix protocol.
    Author:
    Paul Wolneykien
    • Constructor Summary

      Constructors 
      Constructor Description
      JabbixReader​(java.io.InputStream in)
      Creates a reader for the given input stream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String readAll()
      Reads the whole available data to the end of the stream.
      java.lang.String readMessage()
      Reads a message from the input stream.
      java.lang.String readMessage​(boolean untilEOF)
      Reads a message from the input stream.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JabbixReader

        public JabbixReader​(java.io.InputStream in)
        Creates a reader for the given input stream.
        Parameters:
        in - the stream to read from
    • Method Detail

      • readMessage

        public java.lang.String readMessage​(boolean untilEOF)
                                     throws java.io.IOException,
                                            JabbixProtocolException
        Reads a message from the input stream. If the Zabbix protocol is used in the request being read, then the message length is determined from the header. Otherwise, the assumption is made that the end of message is indicated by a separator character (see JabbixProtocol.isSeparator(char)). If the untilEOF flag is passed, then the whole data to the end of the stream is read and returned as one message.
        Parameters:
        untilEOF - the flag telling to read to whole available data
        Returns:
        a message
        Throws:
        java.io.IOException - if an I/O exception occurred during the read operation
        JabbixProtocolException - if the protocol was violated (i.e. an unexpected value was received)
        See Also:
        JabbixProtocol.HEADER
      • readMessage

        public java.lang.String readMessage()
                                     throws java.io.IOException,
                                            JabbixProtocolException
        Reads a message from the input stream. The length of message is either explicitly set in the request header or determined by a separator character (see JabbixProtocol.isSeparator(char)).
        Returns:
        a message
        Throws:
        java.io.IOException - if an I/O exception occurred during the read operation
        JabbixProtocolException - if the protocol was violated (i.e. an unexpected value was received)
        See Also:
        readMessage(boolean)
      • readAll

        public java.lang.String readAll()
                                 throws java.io.IOException,
                                        JabbixProtocolException
        Reads the whole available data to the end of the stream.
        Returns:
        a message containing the all read data
        Throws:
        java.io.IOException - if an I/O exception occurred during the read operation
        JabbixProtocolException - if the protocol was violated (i.e. an unexpected value was received)
        See Also:
        readMessage(boolean)