Package com.norconex.importer.util
Class BufferUtil
- java.lang.Object
-
- com.norconex.importer.util.BufferUtil
-
public final class BufferUtil extends Object
Buffer related utility methods.- Author:
- Pascal Essiembre
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_CONTENT_FROM_END_TO_CUT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
flushBuffer(StringBuilder buffer, Writer out, boolean cutWisely)
Flushes the buffer to output stream.
-
-
-
Field Detail
-
MAX_CONTENT_FROM_END_TO_CUT
public static final int MAX_CONTENT_FROM_END_TO_CUT
- See Also:
- Constant Field Values
-
-
Method Detail
-
flushBuffer
public static void flushBuffer(StringBuilder buffer, Writer out, boolean cutWisely) throws IOException
Flushes the buffer to output stream. If the buffer is considered partial (e.g. containing a partial set of a huge document), you can tell the method to be wise about only flushing the content up to the last line break it finds, dot, or space, when found beforeMAX_CONTENT_FROM_END_TO_CUT
. The remaining content after the cut location will remain in the buffer for further use. If the output writer is null, it will simply truncate the buffer content without writing it anywhere.- Parameters:
buffer
- the buffer to flushout
- where to write the buffer contentcutWisely
- whether to "cut" wisely the buffer content- Throws:
IOException
- when there is a problem flushing the buffer
-
-