Class MultipartBody

    • Method Detail

      • getContentLength

        public long getContentLength()
        Description copied from interface: Body
        Gets the length of the body.
        Specified by:
        getContentLength in interface Body
        Returns:
        The length of the body in bytes, or negative if unknown.
      • getContentType

        public String getContentType()
      • getBoundary

        public byte[] getBoundary()
      • transferTo

        public Body.BodyState transferTo​(io.netty.buffer.ByteBuf target)
                                  throws IOException
        Description copied from interface: Body
        Reads the next chunk of bytes from the body.

        A Body.BodyState.STOP result may be returned by the same call that writes the body's last bytes, so target can still hold unread bytes on STOP. Consumers must drain target before honouring STOP, otherwise the final chunk is lost.

        Specified by:
        transferTo in interface Body
        Parameters:
        target - The buffer to store the chunk in, must not be null.
        Returns:
        The state.
        Throws:
        IOException - If the chunk could not be read.
      • transferTo

        public long transferTo​(WritableByteChannel target)
                        throws IOException
        Description copied from interface: RandomAccessBody
        Transfers the specified chunk of bytes from this body to the specified channel.
        Specified by:
        transferTo in interface RandomAccessBody
        Parameters:
        target - The destination channel to transfer the body chunk to, must not be null.
        Returns:
        The non-negative number of bytes actually transferred.
        Throws:
        IOException - If the body chunk could not be transferred.