Class MessageInput


  • public class MessageInput
    extends java.lang.Object
    An input for messages with their size known so unknown messages can be skipped.
    • Constructor Summary

      Constructors 
      Constructor Description
      MessageInput​(java.io.InputStream inputStream)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getMessageFlags()  
      java.io.DataInput nextMessage()  
      void skipRemainingBytes()
      Skip the remaining bytes of the last message returned from nextMessage().
      • Methods inherited from class java.lang.Object

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

      • MessageInput

        public MessageInput​(java.io.InputStream inputStream)
        Parameters:
        inputStream - Input stream to read from.
    • Method Detail

      • nextMessage

        public java.io.DataInput nextMessage()
                                      throws java.io.IOException
        Returns:
        Data input for the next message. Note that it does not automatically skip over the last message if it was not fully read, for that purpose, skipRemainingBytes() should be explicitly called after reading every message. A null return value indicates the position where MessageOutput#finish() had written the end marker.
        Throws:
        java.io.IOException - On IO error
      • getMessageFlags

        public int getMessageFlags()
        Returns:
        Flags (values 0-3) of the last message for which nextMessage() was called.
      • skipRemainingBytes

        public void skipRemainingBytes()
                                throws java.io.IOException
        Skip the remaining bytes of the last message returned from nextMessage(). This must be called if it is not certain that all of the bytes of the message were consumed.
        Throws:
        java.io.IOException - On IO error