Package org.apache.james.mime4j.stream
Interface FieldBuilder
- All Known Implementing Classes:
DefaultFieldBuilder
public interface FieldBuilder
Field builders are intended to construct RawField
instances from multiple lines
contained in ByteArrayBuffer
s.
Field builders are stateful and modal as they have to store intermediate results between method invocations and also rely on a particular sequence of method invocations (the mode of operation).
Consumers are expected to interact with field builder in the following way:
- Invoke
reset()
method in order to reset builder's internal state and make it ready to start the process of building a newRawField
. - Invoke
append(ByteArrayBuffer)
method one or multiple times in order to build an internal representation of a MIME field from individual lines of text. - Optionally
getRaw()
method can be invoked in order to get combined content of all lines processed so far. Please note builder implementations can returnnull
if they do not retain original raw content. - Invoke
build()
method in order to generate aRawField
instance based on the internal state of the builder.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
append
(ByteArrayBuffer line) Updates builder's internal state by adding a new line of text.build()
Builds an instance ofRawField
based on the internal state.getRaw()
Returns combined content of all lines processed so far ornull
if the builder does not retain original raw content.void
release()
void
reset()
Resets the internal state of the builder making it ready to process new input.
-
Method Details
-
reset
void reset()Resets the internal state of the builder making it ready to process new input. -
append
Updates builder's internal state by adding a new line of text.- Throws:
MimeException
-
build
Builds an instance ofRawField
based on the internal state.- Throws:
MimeException
-
getRaw
RecycledByteArrayBuffer getRaw()Returns combined content of all lines processed so far ornull
if the builder does not retain original raw content. -
release
void release()
-