cascading.scheme.local

## Class TextLine

- java.lang.Object
- - cascading.scheme.Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>
  - - cascading.scheme.local.TextLine

- All Implemented Interfaces:
    Traceable, java.io.Serializable

      public class TextLine
      extends Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>

  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.

  By default, this scheme returns a `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.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DEFAULT_CHARSET`
    `static Fields` | `DEFAULT_SOURCE_FIELDS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `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, java.lang.String charsetName)` Creates a new TextLine instance.
    `TextLine(Fields sourceFields, java.lang.String charsetName)` Creates a new TextLine instance.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.io.LineNumberReader` | `createInput(java.io.InputStream inputStream)`
    `java.io.PrintWriter` | `createOutput(java.io.OutputStream outputStream)`
    `java.lang.String` | `getCharsetName()`
    `void` | `presentSinkFields(FlowProcess<? extends java.util.Properties> process, Tap tap, Fields fields)`
    `void` | `presentSourceFields(FlowProcess<? extends java.util.Properties> process, Tap tap, Fields fields)`
    `void` | `sink(FlowProcess<? extends java.util.Properties> flowProcess, SinkCall<java.io.PrintWriter,java.io.OutputStream> sinkCall)`
    `void` | `sinkCleanup(FlowProcess<? extends java.util.Properties> flowProcess, SinkCall<java.io.PrintWriter,java.io.OutputStream> sinkCall)`
    `void` | `sinkConfInit(FlowProcess<? extends java.util.Properties> flowProcess, Tap<java.util.Properties,java.io.InputStream,java.io.OutputStream> tap, java.util.Properties conf)`
    `void` | `sinkPrepare(FlowProcess<? extends java.util.Properties> flowProcess, SinkCall<java.io.PrintWriter,java.io.OutputStream> sinkCall)`
    `boolean` | `source(FlowProcess<? extends java.util.Properties> flowProcess, SourceCall<java.io.LineNumberReader,java.io.InputStream> sourceCall)`
    `void` | `sourceCleanup(FlowProcess<? extends java.util.Properties> flowProcess, SourceCall<java.io.LineNumberReader,java.io.InputStream> sourceCall)`
    `void` | `sourceConfInit(FlowProcess<? extends java.util.Properties> flowProcess, Tap<java.util.Properties,java.io.InputStream,java.io.OutputStream> tap, java.util.Properties conf)`
    `void` | `sourcePrepare(FlowProcess<? extends java.util.Properties> flowProcess, SourceCall<java.io.LineNumberReader,java.io.InputStream> sourceCall)`
    `void` | `sourceRePrepare(FlowProcess<? extends java.util.Properties> flowProcess, SourceCall<java.io.LineNumberReader,java.io.InputStream> sourceCall)`
    `protected void` | `verify(Fields sourceFields)`

    - ### 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

    - #### DEFAULT_CHARSET

          public static final java.lang.String DEFAULT_CHARSET

      See Also:
        Constant Field Values

    - #### DEFAULT_SOURCE_FIELDS

          public static final Fields DEFAULT_SOURCE_FIELDS

  - ### Constructor Detail

    - #### TextLine

          public 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

          @ConstructorProperties(value="sourceFields")
          public TextLine(Fields sourceFields)

      Creates a new TextLine instance. If sourceFields has one field, only the text line will be returned in the subsequent tuples.
      Parameters:
        `sourceFields` - of Fields

    - #### TextLine

          @ConstructorProperties(value={"sourceFields","charsetName"})
          public TextLine(Fields sourceFields,
                                        java.lang.String charsetName)

      Creates a new TextLine instance. If sourceFields has one field, only the text line will be returned in the subsequent tuples.
      Parameters:
        `sourceFields` - of Fields
        `charsetName` - of type String

    - #### TextLine

          @ConstructorProperties(value={"sourceFields","sinkFields"})
          public TextLine(Fields sourceFields,
                                        Fields sinkFields)

      Creates a new TextLine instance. If sourceFields has one field, only the text line will be returned in the subsequent tuples.
      Parameters:
        `sourceFields` - of Fields
        `sinkFields` - of Fields

    - #### TextLine

          @ConstructorProperties(value={"sourceFields","sinkFields","charsetName"})
          public TextLine(Fields sourceFields,
                                        Fields sinkFields,
                                        java.lang.String charsetName)

      Creates a new TextLine instance. If sourceFields has one field, only the text line will be returned in the subsequent tuples.
      Parameters:
        `sourceFields` - of Fields
        `sinkFields` - of Fields
        `charsetName` - of type String

  - ### Method Detail

    - #### getCharsetName

          public java.lang.String getCharsetName()

    - #### verify

          protected void verify(Fields sourceFields)

    - #### createInput

          public java.io.LineNumberReader createInput(java.io.InputStream inputStream)

    - #### createOutput

          public java.io.PrintWriter createOutput(java.io.OutputStream outputStream)

    - #### presentSourceFields

          public void presentSourceFields(FlowProcess<? extends java.util.Properties> process,
                                 Tap tap,
                                 Fields fields)

      Overrides:
        `presentSourceFields` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`

    - #### presentSinkFields

          public void presentSinkFields(FlowProcess<? extends java.util.Properties> process,
                               Tap tap,
                               Fields fields)

      Overrides:
        `presentSinkFields` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`

    - #### sourceConfInit

          public void sourceConfInit(FlowProcess<? extends java.util.Properties> flowProcess,
                            Tap<java.util.Properties,java.io.InputStream,java.io.OutputStream> tap,
                            java.util.Properties conf)

      Specified by:
        `sourceConfInit` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`

    - #### sinkConfInit

          public void sinkConfInit(FlowProcess<? extends java.util.Properties> flowProcess,
                          Tap<java.util.Properties,java.io.InputStream,java.io.OutputStream> tap,
                          java.util.Properties conf)

      Specified by:
        `sinkConfInit` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`

    - #### sourcePrepare

          public void sourcePrepare(FlowProcess<? extends java.util.Properties> flowProcess,
                           SourceCall<java.io.LineNumberReader,java.io.InputStream> sourceCall)
                             throws java.io.IOException

      Overrides:
        `sourcePrepare` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`
      Throws:
        `java.io.IOException`

    - #### sourceRePrepare

          public void sourceRePrepare(FlowProcess<? extends java.util.Properties> flowProcess,
                             SourceCall<java.io.LineNumberReader,java.io.InputStream> sourceCall)
                               throws java.io.IOException

      Overrides:
        `sourceRePrepare` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`
      Throws:
        `java.io.IOException`

    - #### source

          public boolean source(FlowProcess<? extends java.util.Properties> flowProcess,
                       SourceCall<java.io.LineNumberReader,java.io.InputStream> sourceCall)
                         throws java.io.IOException

      Specified by:
        `source` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`
      Throws:
        `java.io.IOException`

    - #### sourceCleanup

          public void sourceCleanup(FlowProcess<? extends java.util.Properties> flowProcess,
                           SourceCall<java.io.LineNumberReader,java.io.InputStream> sourceCall)
                             throws java.io.IOException

      Overrides:
        `sourceCleanup` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`
      Throws:
        `java.io.IOException`

    - #### sinkPrepare

          public void sinkPrepare(FlowProcess<? extends java.util.Properties> flowProcess,
                         SinkCall<java.io.PrintWriter,java.io.OutputStream> sinkCall)
                           throws java.io.IOException

      Overrides:
        `sinkPrepare` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`
      Throws:
        `java.io.IOException`

    - #### sink

          public void sink(FlowProcess<? extends java.util.Properties> flowProcess,
                  SinkCall<java.io.PrintWriter,java.io.OutputStream> sinkCall)
                    throws java.io.IOException

      Specified by:
        `sink` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`
      Throws:
        `java.io.IOException`

    - #### sinkCleanup

          public void sinkCleanup(FlowProcess<? extends java.util.Properties> flowProcess,
                         SinkCall<java.io.PrintWriter,java.io.OutputStream> sinkCall)
                           throws java.io.IOException

      Overrides:
        `sinkCleanup` in class `Scheme<java.util.Properties,java.io.InputStream,java.io.OutputStream,java.io.LineNumberReader,java.io.PrintWriter>`
      Throws:
        `java.io.IOException`

Copyright © 2007-2015 Xplenty, Inc. All Rights Reserved.