Package com.norconex.importer.util
Class BufferUtil
java.lang.Object
com.norconex.importer.util.BufferUtil
Buffer related utility methods.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidflushBuffer(StringBuilder buffer, Writer out, boolean cutWisely) Flushes the buffer to output stream.
-
Field Details
-
MAX_CONTENT_FROM_END_TO_CUT
public static final int MAX_CONTENT_FROM_END_TO_CUT- See Also:
-
-
Method Details
-
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
-