Interface ByteData

All Superinterfaces:
UploadData

public interface ByteData extends UploadData
An upload data as a sequence of bytes.
  • Method Summary

    Modifier and Type
    Method
    Description
    default byte[]
    Returns an array containing the upload data bytes of the associated URL request.
    default ContentType
    Returns the content type of this upload data as specified in the Content-Type header.
    static ByteData
    of(byte[] data)
    Creates an instance of ByteData with the given upload data bytes.
    static ByteData
    of(byte[] data, ContentType contentType)
    Creates an instance of ByteData with the given upload data bytes and content type.
    static ByteData
    of(String data)
    Creates an instance of ByteData with the given upload data bytes.
    static ByteData
    of(String data, ContentType contentType)
    Creates an instance of ByteData with the given upload data bytes and content type.
  • Method Details

    • of

      static ByteData of(String data)
      Creates an instance of ByteData with the given upload data bytes.

      The bytes are retrieved from the data string using the String.getBytes(Charset) method with the UTF-8 charset.

    • of

      static ByteData of(byte[] data)
      Creates an instance of ByteData with the given upload data bytes.
    • of

      static ByteData of(String data, ContentType contentType)
      Creates an instance of ByteData with the given upload data bytes and content type.

      The bytes are retrieved from the data string using the String.getBytes(Charset) method with the UTF-8 charset.

      Since:
      7.33
    • of

      static ByteData of(byte[] data, ContentType contentType)
      Creates an instance of ByteData with the given upload data bytes and content type.
      Since:
      7.33
    • bytes

      default byte[] bytes()
      Description copied from interface: UploadData
      Returns an array containing the upload data bytes of the associated URL request.

      If the upload data is constructed manually and is not associated with a URL request, returns an empty array.

      Specified by:
      bytes in interface UploadData
    • contentType

      default ContentType contentType()
      Description copied from interface: UploadData
      Returns the content type of this upload data as specified in the Content-Type header.

      If the upload data is constructed manually, the Content-Type header will be created after it is passed to the Chromium engine. Thus, the returned ContentType object will not contain meaningful values in this case.

      Specified by:
      contentType in interface UploadData