public class LineCountSplitter extends MessageSplitterImp
Split an AdaptrisMessage object by line. Counts the number of lines, and creates a new message based on some configured number. This Splitter can handle arbitrarily large (File Backed) messages.
In the adapter configuration file this class is aliased as line-count-splitter which is the preferred alternative to the fully qualified classname when building your configuration.
MessageSplitterImp.SplitMessageIterator
logR
Constructor and Description |
---|
LineCountSplitter() |
LineCountSplitter(java.lang.Integer splitOnLine) |
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
getBufferSize() |
java.lang.Boolean |
getIgnoreBlankLines()
Whether to ignore blank lines or not.
|
java.lang.Integer |
getKeepHeaderLines() |
java.lang.Integer |
getSplitOnLine()
Get the number of lines that we are splitting on.
|
void |
setBufferSize(java.lang.Integer b)
Set the internal buffer size.
|
void |
setIgnoreBlankLines(java.lang.Boolean b)
Specify whether to ignore blank lines or not.
|
void |
setKeepHeaderLines(java.lang.Integer keepHeaderLines) |
void |
setSplitOnLine(java.lang.Integer i)
Set the boundary marker so that the file is split every
i lines. |
CloseableIterable<AdaptrisMessage> |
splitMessage(AdaptrisMessage msg)
Splits an
AdaptrisMessage into some number of AdaptrisMessage objects. |
copyMetadata, getCopyMetadata, getCopyObjectMetadata, getMessageFactory, selectFactory, setCopyMetadata, setCopyObjectMetadata, setMessageFactory
public LineCountSplitter()
public LineCountSplitter(java.lang.Integer splitOnLine)
public CloseableIterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg) throws CoreException
MessageSplitter
Splits an AdaptrisMessage
into some number of AdaptrisMessage objects. Preservation of metadata is down to the
implementation.
If this method returns a CloseableIterable
, it must be closed by the caller! This contract cannot be clearly
expressed in Java code without breaking the API in uncomfortable ways for things just returning a List, which is why
this method is only declared to return Iterable.
msg
- the msg to splitIterable
of AdaptrisMessage
CoreException
- wrapping any other exceptionpublic void setSplitOnLine(java.lang.Integer i)
i
lines.i
- the number of lines to split onpublic java.lang.Integer getSplitOnLine()
public void setIgnoreBlankLines(java.lang.Boolean b)
If blank lines are ignored, then they will not count towards the splitOnLine
total, or be output into the
resulting split message.
b
- true to ignore blank lines, default falsepublic java.lang.Boolean getIgnoreBlankLines()
setIgnoreBlankLines(Boolean)
public java.lang.Integer getBufferSize()
public void setBufferSize(java.lang.Integer b)
The default buffer size matches the default buffer size in BufferedReader
and BufferedWriter
, changes to the
buffersize will impact performance and memory usage depending on the underlying operating system/disk.
b
- the buffer size (default is 8192).public java.lang.Integer getKeepHeaderLines()
public void setKeepHeaderLines(java.lang.Integer keepHeaderLines)