Class Output

java.lang.Object
ai.djl.modality.Input
ai.djl.modality.Output

public class Output extends Input
A class stores the generic inference results.
  • Constructor Details

    • Output

      public Output()
      Constructs a Output instance.
    • Output

      public Output(int code, String message)
      Constructs a Output with specified requestId, code and message.
      Parameters:
      code - the status code of the output
      message - the status message of the output
  • Method Details

    • getCode

      public int getCode()
      Returns the status code of the output.
      Returns:
      the status code of the output
    • setCode

      public void setCode(int code)
      Sets the status code of the output.
      Parameters:
      code - the status code of the output
    • getMessage

      public String getMessage()
      Returns the status code of the output.
      Returns:
      the status code of the output
    • setMessage

      public void setMessage(String message)
      Sets the status message of the output.
      Parameters:
      message - the status message of the output
    • encode

      public byte[] encode() throws IOException
      Encodes all data in the output to a binary form.
      Overrides:
      encode in class Input
      Returns:
      the binary encoding
      Throws:
      IOException - if it fails to encode part of the data
    • decode

      public static Output decode(InputStream is) throws IOException
      Decodes the output from encode().
      Parameters:
      is - the data to decode from
      Returns:
      the decoded output
      Throws:
      IOException - if it fails to decode part of the output
    • deepEquals

      public boolean deepEquals(Object o)
      Checks for deep equality with another output.
      Overrides:
      deepEquals in class Input
      Parameters:
      o - the other output.
      Returns:
      whether they and all properties, content, and data are equal