Class RegexLineIterator
java.lang.Object
org.archive.util.iterator.LookaheadIterator<String>
org.archive.util.iterator.TransformingIteratorWrapper<String,String>
org.archive.util.iterator.RegexLineIterator
Utility class providing an Iterator interface over line-oriented
text input. By providing regexs indicating lines to ignore
(such as pure whitespace or comments), lines to consider input, and
what to return from the input lines (such as a whitespace-trimmed
non-whitespace token with optional trailing comment), this can
be configured to handle a number of formats.
The public static members provide pattern configurations that will
be helpful in a wide variety of contexts.
- Author:
- gojomo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected Matcherprotected Matcherstatic final Stringprotected Stringstatic final StringFields inherited from class TransformingIteratorWrapper
innerFields inherited from class LookaheadIterator
next -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class TransformingIteratorWrapper
lookahead, noteExhaustedMethods inherited from class LookaheadIterator
hasNext, next, removeMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
COMMENT_LINE
- See Also:
-
NONWHITESPACE_ENTRY_TRAILING_COMMENT
- See Also:
-
TRIMMED_ENTRY_TRAILING_COMMENT
- See Also:
-
ENTRY
- See Also:
-
ignoreLine
-
extractLine
-
outputTemplate
-
-
Constructor Details
-
RegexLineIterator
-
-
Method Details
-
transform
Loads next item into lookahead spot, if available. Skips lines matching ignoreLine; extracts desired portion of lines matching extractLine; informationally reports any lines matching neither.- Specified by:
transformin classTransformingIteratorWrapper<String,String> - Parameters:
line- Object to transform.- Returns:
- whether any item was loaded into next field
-