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 ByteArrayBuffers.

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:


Method Summary
 void append(ByteArrayBuffer line)
          Updates builder's internal state by adding a new line of text.
 RawField build()
          Builds an instance of RawField based on the internal state.
 ByteArrayBuffer getRaw()
          Returns combined content of all lines processed so far or null if the builder does not retain original raw content.
 void reset()
          Resets the internal state of the builder making it ready to process new input.
 

Method Detail

reset

void reset()
Resets the internal state of the builder making it ready to process new input.


append

void append(ByteArrayBuffer line)
            throws MimeException
Updates builder's internal state by adding a new line of text.

Throws:
MimeException

build

RawField build()
               throws MimeException
Builds an instance of RawField based on the internal state.

Throws:
MimeException

getRaw

ByteArrayBuffer getRaw()
Returns combined content of all lines processed so far or null if the builder does not retain original raw content.



Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.