Class LineCountSplitter
- java.lang.Object
-
- com.adaptris.core.services.splitter.MessageSplitterImp
-
- com.adaptris.core.services.splitter.LineCountSplitter
-
- All Implemented Interfaces:
MessageSplitter
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.adaptris.core.services.splitter.MessageSplitterImp
MessageSplitterImp.SplitMessageIterator
-
-
Field Summary
-
Fields inherited from class com.adaptris.core.services.splitter.MessageSplitterImp
logR
-
-
Constructor Summary
Constructors Constructor Description LineCountSplitter()
LineCountSplitter(java.lang.Integer splitOnLine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 everyi
lines.CloseableIterable<AdaptrisMessage>
splitMessage(AdaptrisMessage msg)
Splits anAdaptrisMessage
into some number of AdaptrisMessage objects.-
Methods inherited from class com.adaptris.core.services.splitter.MessageSplitterImp
copyMetadata, getCopyMetadata, getCopyObjectMetadata, getMessageFactory, selectFactory, setCopyMetadata, setCopyObjectMetadata, setMessageFactory
-
-
-
-
Method Detail
-
splitMessage
public CloseableIterable<AdaptrisMessage> splitMessage(AdaptrisMessage msg) throws CoreException
Description copied from interface: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.- Parameters:
msg
- the msg to split- Returns:
- an
Iterable
ofAdaptrisMessage
- Throws:
CoreException
- wrapping any other exception
-
setSplitOnLine
public void setSplitOnLine(java.lang.Integer i)
Set the boundary marker so that the file is split everyi
lines.- Parameters:
i
- the number of lines to split on
-
getSplitOnLine
public java.lang.Integer getSplitOnLine()
Get the number of lines that we are splitting on.- Returns:
- the number of lines.
-
setIgnoreBlankLines
public void setIgnoreBlankLines(java.lang.Boolean b)
Specify whether to ignore blank lines or not.If blank lines are ignored, then they will not count towards the
splitOnLine
total, or be output into the resulting split message.- Parameters:
b
- true to ignore blank lines, default false
-
getIgnoreBlankLines
public java.lang.Boolean getIgnoreBlankLines()
Whether to ignore blank lines or not.- Returns:
- true or false;
- See Also:
setIgnoreBlankLines(Boolean)
-
getBufferSize
public java.lang.Integer getBufferSize()
-
setBufferSize
public void setBufferSize(java.lang.Integer b)
Set the internal buffer size.The default buffer size matches the default buffer size in
BufferedReader
andBufferedWriter
, changes to the buffersize will impact performance and memory usage depending on the underlying operating system/disk.- Parameters:
b
- the buffer size (default is 8192).
-
getKeepHeaderLines
public java.lang.Integer getKeepHeaderLines()
-
setKeepHeaderLines
public void setKeepHeaderLines(java.lang.Integer keepHeaderLines)
-
-