Class ByteArrayRequestEntity

  • All Implemented Interfaces:
    RequestEntity

    public class ByteArrayRequestEntity
    extends java.lang.Object
    implements RequestEntity
    A RequestEntity that contains an array of bytes.
    Since:
    3.0
    • Constructor Detail

      • ByteArrayRequestEntity

        public ByteArrayRequestEntity​(byte[] content)
        Creates a new entity with the given content.
        Parameters:
        content - The content to set.
      • ByteArrayRequestEntity

        public ByteArrayRequestEntity​(byte[] content,
                                      java.lang.String contentType)
        Creates a new entity with the given content and content type.
        Parameters:
        content - The content to set.
        contentType - The content type to set or null.
    • Method Detail

      • writeRequest

        public void writeRequest​(java.io.OutputStream out)
                          throws java.io.IOException
        Description copied from interface: RequestEntity
        Writes the request entity to the given stream.
        Specified by:
        writeRequest in interface RequestEntity
        Throws:
        java.io.IOException
      • getContentLength

        public long getContentLength()
        Description copied from interface: RequestEntity
        Gets the request entity's length. This method should return a non-negative value if the content length is known or a negative value if it is not. In the latter case the EntityEnclosingMethod will use chunk encoding to transmit the request entity.
        Specified by:
        getContentLength in interface RequestEntity
        Returns:
        The length of the content.
      • getContent

        public byte[] getContent()
        Returns:
        Returns the content.