Class SimpleBody


  • public final class SimpleBody
    extends java.lang.Object
    Message body representation as a simple text string or an array of bytes.
    Since:
    5.0
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBodyBytes()
      Gets the body as a byte array.
      java.lang.String getBodyText()
      Gets the body as a String.
      org.apache.hc.core5.http.ContentType getContentType()
      Gets the content type.
      boolean isBytes()
      Tests whether the body is currently cached as a byte array.
      boolean isText()
      Tests whether the body is currently cached as a String.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • getContentType

        public org.apache.hc.core5.http.ContentType getContentType()
        Gets the content type.
        Returns:
        the content type.
      • getBodyBytes

        public byte[] getBodyBytes()
        Gets the body as a byte array.
        Returns:
        the body as a byte array.
      • getBodyText

        public java.lang.String getBodyText()
        Gets the body as a String.
        Returns:
        the body as a String.
      • isText

        public boolean isText()
        Tests whether the body is currently cached as a String.
        Returns:
        whether the body is currently cached as a String.
      • isBytes

        public boolean isBytes()
        Tests whether the body is currently cached as a byte array.
        Returns:
        whether the body is currently cached as a byte array.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object