Class ProxyPayload

java.lang.Object
net.flectone.pulse.util.payload.ProxyPayload
All Implemented Interfaces:
Closeable, AutoCloseable

public class ProxyPayload extends Object implements Closeable
Reads the extra data attached to a proxy message, in the same order the sender wrote it.
  • Constructor Details

    • ProxyPayload

      public ProxyPayload(byte[] bytes)
      Opens a payload for reading.
      Parameters:
      bytes - the raw payload
  • Method Details

    • readString

      public String readString() throws IOException
      Reads a string.
      Returns:
      the value
      Throws:
      IOException - if the payload ends early
    • readInt

      public int readInt() throws IOException
      Reads an int.
      Returns:
      the value
      Throws:
      IOException - if the payload ends early
    • readLong

      public long readLong() throws IOException
      Reads a long.
      Returns:
      the value
      Throws:
      IOException - if the payload ends early
    • readBoolean

      public boolean readBoolean() throws IOException
      Reads a boolean.
      Returns:
      the value
      Throws:
      IOException - if the payload ends early
    • readUUID

      public UUID readUUID() throws IOException
      Reads a uuid.
      Returns:
      the value
      Throws:
      IOException - if the payload ends early
    • readAllBytes

      public byte[] readAllBytes() throws IOException
      Reads whatever is left of the payload.
      Returns:
      the remaining bytes
      Throws:
      IOException - if reading fails
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException