Package org.apache.james.mime4j.stream
Class DefaultFieldBuilder
- java.lang.Object
-
- org.apache.james.mime4j.stream.DefaultFieldBuilder
-
- All Implemented Interfaces:
FieldBuilder
public class DefaultFieldBuilder extends java.lang.Object implements FieldBuilder
Default implementation ofFieldBuilder
.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>>
_recyclerRef
private RecycledByteArrayBuffer
buf
private static java.util.BitSet
FIELD_CHARS
private int
maxlen
-
Constructor Summary
Constructors Constructor Description DefaultFieldBuilder(int maxlen)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
append(ByteArrayBuffer line)
Updates builder's internal state by adding a new line of text.RawField
build()
Builds an instance ofRawField
based on the internal state.static BufferRecycler
getBufferRecycler()
RecycledByteArrayBuffer
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.
-
-
-
Field Detail
-
_recyclerRef
protected static final java.lang.ThreadLocal<java.lang.ref.SoftReference<BufferRecycler>> _recyclerRef
-
FIELD_CHARS
private static final java.util.BitSet FIELD_CHARS
-
buf
private final RecycledByteArrayBuffer buf
-
maxlen
private final int maxlen
-
-
Method Detail
-
getBufferRecycler
public static BufferRecycler getBufferRecycler()
-
reset
public void reset()
Description copied from interface:FieldBuilder
Resets the internal state of the builder making it ready to process new input.- Specified by:
reset
in interfaceFieldBuilder
-
append
public void append(ByteArrayBuffer line) throws MaxHeaderLengthLimitException
Description copied from interface:FieldBuilder
Updates builder's internal state by adding a new line of text.- Specified by:
append
in interfaceFieldBuilder
- Throws:
MaxHeaderLengthLimitException
-
build
public RawField build() throws MimeException
Description copied from interface:FieldBuilder
Builds an instance ofRawField
based on the internal state.- Specified by:
build
in interfaceFieldBuilder
- Throws:
MimeException
-
getRaw
public RecycledByteArrayBuffer getRaw()
Description copied from interface:FieldBuilder
Returns combined content of all lines processed so far ornull
if the builder does not retain original raw content.- Specified by:
getRaw
in interfaceFieldBuilder
-
release
public void release()
- Specified by:
release
in interfaceFieldBuilder
-
-