Class MultiPart
Namespace class for interrelated classes that provide support for parsing and generating multipart bytes.
Most applications should make use of MultiPartFormData
or MultiPartByteRanges
as they provide a simpler API.
Multipart parsing is provided by MultiPart.Parser
.
Multipart generation is provided by MultiPart.AbstractContentSource
and its subclasses.
A single part of a multipart content is represented by MultiPart.Part
and its subclasses.
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
An asynchronousContent.Source
whereMultiPart.Part
s can be added to it to form a multipart content.static class
AMultiPart.Parser.Listener
that emitsMultiPart.Part
objects.static class
AMultiPart.Part
that holds its content in memory, in one or moreByteBuffer
s.static class
AMultiPart.Part
that holds its content in one or moreContent.Chunk
s.static class
AMultiPart.Part
whose content is aContent.Source
.static class
Amultipart/form-data
parser that follows RFC 7578.static class
A single part of a multipart content.static class
AMultiPart.Part
whose content is in a file. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
extractBoundary
(String contentType) Extracts the value of theboundary
parameter from theContent-Type
header value, or returnsnull
if theboundary
parameter is missing.static String
generateBoundary
(String prefix, int randomLength) Generates a multipart boundary, made of the given optional prefix string and the given number of random characters.
-
Method Details
-
extractBoundary
Extracts the value of the
boundary
parameter from theContent-Type
header value, or returnsnull
if theboundary
parameter is missing.- Parameters:
contentType
- theContent-Type
header value- Returns:
- the value of the
boundary
parameter, ornull
if theboundary
parameter is missing
-
generateBoundary
Generates a multipart boundary, made of the given optional prefix string and the given number of random characters.
The total length of the boundary will be trimmed to at most 70 characters, as specified in RFC 2046.
- Parameters:
prefix
- a possiblynull
prefixrandomLength
- a number of random characters to add after the prefix- Returns:
- a boundary string
-