public class LineStream extends AbstractLineStream
getKey() method of this instance. By default the key
LINE is used.
It also supports the specification of a simple format string that can be used
to create a generic parser to populate additional fields of the data item
read from the stream.
The parser format is:
%{IP} [%{DATE}] "%{URL}"
This will create a parser that is able to read line in the format
127.0.0.1 [2012/03/14 12:03:48 +0100] "http://example.com/index.html"
The outcoming data item will have the attribute IP set to
"127.0.0.1" and the DATE attribute set to
"2012/03/14 12:03:48 +0100". The URL attribute will be set to
http://example.com/index.html.| Modifier and Type | Field and Description |
|---|---|
(package private) String |
format |
(package private) String |
key |
(package private) static org.slf4j.Logger |
log |
(package private) Parser<Map<String,String>> |
parser |
attributes, encoding, readerclosed, count, id, in, limit, prefix, seqId, sequenceKey, urlSOURCE_KEY| Constructor and Description |
|---|
LineStream(InputStream in) |
LineStream(SourceURL url) |
| Modifier and Type | Method and Description |
|---|---|
String |
getFormat() |
String |
getKey() |
Data |
readNext() |
void |
setFormat(String format) |
void |
setKey(String key) |
close, getEncoding, init, readLine, setEncodinggetId, getInputStream, getLimit, getPrefix, getSequenceKey, getUrl, read, setId, setLimit, setPrefix, setSequenceKey, setUrlpublic LineStream(InputStream in) throws Exception
Exceptionpublic String getKey()
@Parameter(required=false, defaultValue="LINE", description="") public void setKey(String key)
key - the key to setpublic String getFormat()
@Parameter(required=false, description="The format how to parse each line. Elements like %(KEY) will be detected and automatically populated in the resulting items.") public void setFormat(String format)
format - the format to setpublic Data readNext() throws Exception
readNext in class AbstractStreamExceptionstream.io.AbstractStream#readItem(stream.Data)Copyright © 2018. All rights reserved.