|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cascading.scheme.Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter> cascading.scheme.local.TextLine
public class TextLine
A TextLine is a type of Scheme
for plain text files. Files are broken into
lines. Either line-feed or carriage-return are used to signal end of line.
Tuple
with two fields, "num" and "line". Where "num"
is the line number for "line".
Many of the constructors take both "sourceFields" and "sinkFields". sourceFields denote the field names
to be used instead of the names "num" and "line". sinkFields is a selector and is by default Fields.ALL
.
Any available field names can be given if only a subset of the incoming fields should be used.
If a Fields
instance is passed on the constructor as sourceFields having only one field, the return tuples
will simply be the "line" value using the given field name.
Note that TextLine will concatenate all the Tuple values for the selected fields with a TAB delimiter before
writing out the line.
By default, all text is encoded/decoded as UTF-8. This can be changed via the charsetName
constructor
argument.
Field Summary | |
---|---|
static String |
DEFAULT_CHARSET
|
Constructor Summary | |
---|---|
TextLine()
Creates a new TextLine instance that sources "num" and "line" fields, and sinks all incoming fields, where "num" is the line number of the line in the input file. |
|
TextLine(Fields sourceFields)
Creates a new TextLine instance. |
|
TextLine(Fields sourceFields,
Fields sinkFields)
Creates a new TextLine instance. |
|
TextLine(Fields sourceFields,
Fields sinkFields,
String charsetName)
Creates a new TextLine instance. |
|
TextLine(Fields sourceFields,
String charsetName)
Creates a new TextLine instance. |
Methods inherited from class cascading.scheme.Scheme |
---|
equals, getNumSinkParts, getSinkFields, getSourceFields, getTrace, hashCode, isSink, isSource, isSymmetrical, presentSinkFieldsInternal, presentSourceFieldsInternal, retrieveSinkFields, retrieveSourceFields, setNumSinkParts, setSinkFields, setSourceFields, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_CHARSET
Constructor Detail |
---|
public TextLine()
@ConstructorProperties(value="sourceFields") public TextLine(Fields sourceFields)
sourceFields
- of Fields@ConstructorProperties(value={"sourceFields","charsetName"}) public TextLine(Fields sourceFields, String charsetName)
sourceFields
- of FieldscharsetName
- of type String@ConstructorProperties(value={"sourceFields","sinkFields"}) public TextLine(Fields sourceFields, Fields sinkFields)
sourceFields
- of FieldssinkFields
- of Fields@ConstructorProperties(value={"sourceFields","sinkFields","charsetName"}) public TextLine(Fields sourceFields, Fields sinkFields, String charsetName)
sourceFields
- of FieldssinkFields
- of FieldscharsetName
- of type StringMethod Detail |
---|
public String getCharsetName()
protected void verify(Fields sourceFields)
public LineNumberReader createInput(InputStream inputStream)
public PrintWriter createOutput(OutputStream outputStream)
public void presentSourceFields(FlowProcess<Properties> process, Tap tap, Fields fields)
presentSourceFields
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
public void presentSinkFields(FlowProcess<Properties> process, Tap tap, Fields fields)
presentSinkFields
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
public void sourceConfInit(FlowProcess<Properties> flowProcess, Tap<Properties,InputStream,OutputStream> tap, Properties conf)
sourceConfInit
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
public void sinkConfInit(FlowProcess<Properties> flowProcess, Tap<Properties,InputStream,OutputStream> tap, Properties conf)
sinkConfInit
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
public void sourcePrepare(FlowProcess<Properties> flowProcess, SourceCall<LineNumberReader,InputStream> sourceCall) throws IOException
sourcePrepare
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
IOException
public boolean source(FlowProcess<Properties> flowProcess, SourceCall<LineNumberReader,InputStream> sourceCall) throws IOException
source
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
IOException
public void sourceCleanup(FlowProcess<Properties> flowProcess, SourceCall<LineNumberReader,InputStream> sourceCall) throws IOException
sourceCleanup
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
IOException
public void sinkPrepare(FlowProcess<Properties> flowProcess, SinkCall<PrintWriter,OutputStream> sinkCall) throws IOException
sinkPrepare
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
IOException
public void sink(FlowProcess<Properties> flowProcess, SinkCall<PrintWriter,OutputStream> sinkCall) throws IOException
sink
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
IOException
public void sinkCleanup(FlowProcess<Properties> flowProcess, SinkCall<PrintWriter,OutputStream> sinkCall) throws IOException
sinkCleanup
in class Scheme<Properties,InputStream,OutputStream,LineNumberReader,PrintWriter>
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |