- java.lang.Object
-
- io.helidon.media.multipart.ReadableBodyPart
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReadableBodyPart.Builder
Builder class for creatingBodyPart
instances.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
as(Class<T> clazz)
Converts the part content into an instance of the requested type.static ReadableBodyPart.Builder
builder()
Create a new builder instance.MessageBodyReadableContent
content()
Get the reactive representation of the part content.void
drain()
Release all chunks and complete publisher of part's content.ReadableBodyPartHeaders
headers()
Returns HTTP part headers.boolean
isBuffered()
Indicate if the content of thisBodyPart
instance is buffered in memory.
-
-
-
Method Detail
-
content
public MessageBodyReadableContent content()
Description copied from interface:BodyPart
Get the reactive representation of the part content.- Specified by:
content
in interfaceBodyPart
- Returns:
MessageBodyContent
, nevernull
-
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.
-
isBuffered
public boolean isBuffered()
Indicate if the content of thisBodyPart
instance is buffered in memory. When buffered,as(java.lang.Class)
can be called to unmarshall the content synchronously. Otherwise, usecontent()
andMessageBodyReadableContent.as(Class)
to do it asynchronously with aSingle
.- 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!, seeisBuffered()
.- 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
-
-