Class MultiPart.Parser
- Enclosing class:
 MultiPart
A multipart/form-data parser that follows
RFC 7578.
RFC 7578 mandates that end-of-lines are CRLF, but this parser is more lenient and it is able to parse multipart content that only uses LF as end-of-line.
The parser emits events specified by MultiPart.Parser.Listener, that can be
implemented to support specific logic (for example, the max content
length of a part, etc.
- See Also:
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA listener for events emitted by aMultiPart.Parser. - 
Constructor Summary
ConstructorsConstructorDescriptionParser(String boundary, MultiPart.Parser.Listener listener) Parser(String boundary, MultiPartCompliance compliance, MultiPart.Parser.Listener listener)  - 
Method Summary
Modifier and TypeMethodDescriptionlongintvoidparse(Content.Chunk chunk) Parses the multipart/form-data bytes contained in the givenContent.Chunk.voidreset()Resets this parser to make it ready to parse again a multipart/form-data content.voidsetMaxParts(long maxParts) voidsetPartHeadersMaxLength(int partHeadersMaxLength)  
- 
Constructor Details
- 
Parser
 - 
Parser
 
 - 
 - 
Method Details
- 
getBoundary
 - 
getPartHeadersMaxLength
public int getPartHeadersMaxLength()- Returns:
 - the max length of a 
MultiPart.Partheaders, in bytes, or -1 for unlimited length 
 - 
setPartHeadersMaxLength
public void setPartHeadersMaxLength(int partHeadersMaxLength) - Parameters:
 partHeadersMaxLength- the max length of aMultiPart.Partheaders, in bytes, or -1 for unlimited length
 - 
getMaxParts
public long getMaxParts()- Returns:
 - the maximum number of parts that can be parsed from the multipart content (0 for no parts allowed, -1 for unlimited parts).
 
 - 
setMaxParts
public void setMaxParts(long maxParts) - Parameters:
 maxParts- the maximum number of parts that can be parsed from the multipart content (0 for no parts allowed, -1 for unlimited parts).
 - 
reset
public void reset()Resets this parser to make it ready to parse again a multipart/form-data content.
 - 
parse
Parses the multipart/form-data bytes contained in the given
Content.Chunk.Parsing the bytes will emit events to a
MultiPart.Parser.Listener.The multipart/form-data content may be split into multiple chunks; each chunk should be passed to this method when it is available, with the last chunk signaling that the whole multipart/form-data content has been given to this parser, which will eventually emit the
completeevent.In case of parsing errors, the
failureevent will be emitted.- Parameters:
 chunk- theContent.Chunkto parse- See Also:
 
 
 -