Class ReadableBodyPart

java.lang.Object
io.helidon.media.multipart.ReadableBodyPart
All Implemented Interfaces:
BodyPart

public final class ReadableBodyPart extends Object implements BodyPart
Readable body part entity.
  • Method Details

    • content

      public MessageBodyReadableContent content()
      Description copied from interface: BodyPart
      Get the reactive representation of the part content.
      Specified by:
      content in interface BodyPart
      Returns:
      MessageBodyContent, never null
    • drain

      public void drain()
      Release all chunks and complete publisher of part's content.
    • headers

      public ReadableBodyPartHeaders headers()
      Description copied from interface: BodyPart
      Returns HTTP part headers.
      Specified by:
      headers in interface BodyPart
      Returns:
      BodyPartHeaders, never null
    • isBuffered

      public boolean isBuffered()
      Indicate if the content of this BodyPart instance is buffered in memory. When buffered, as(java.lang.Class) can be called to unmarshall the content synchronously. Otherwise, use content() and MessageBodyReadableContent.as(Class) to do it asynchronously with a Single.
      Returns:
      true if buffered, false otherwise
    • as

      public <T> T as(Class<T> clazz)
      Converts the part content into an instance of the requested type. This method can only be used if the part content is buffered!, see isBuffered().
      Type Parameters:
      T - the requested type
      Parameters:
      clazz - the requested type class
      Returns:
      T the converted content
      Throws:
      IllegalStateException - if the part is not buffered or if an error occurs while converting the content
    • builder

      public static ReadableBodyPart.Builder builder()
      Create a new builder instance.
      Returns:
      Builder