org.modeshape.sequencer.text

## Class FixedWidthTextSequencer

- java.lang.Object
- - org.modeshape.jcr.api.sequencer.Sequencer
  - - org.modeshape.sequencer.text.AbstractTextSequencer
    - - org.modeshape.sequencer.text.FixedWidthTextSequencer

-     public class FixedWidthTextSequencer
      extends AbstractTextSequencer

  An text sequencer implementation that uses a `list of column numbers` to split incoming rows into fixed-width columns. By default, this class treats each row as a single column. There is an implicit column start index of 0 for the first column.
  See Also:
    `AbstractTextSequencer`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.modeshape.jcr.api.sequencer.Sequencer

      `Sequencer.Context`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FixedWidthTextSequencer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected String[]` | `parseLine(String line)` Parse the given row into its constituent columns.
    `void` | `setColumnStartPositions(int[] columnStartPositions)` Set the column start positions.
    `void` | `setColumnStartPositions(String commaDelimitedColumnStartPositions)` Set the column start positions from a list of column start positions concatenated into a single, comma-delimited string.

    - ### Methods inherited from class org.modeshape.sequencer.text.AbstractTextSequencer

      `execute, getCommentMarker, getMaximumLinesToRead, getRowFactoryClassName, initialize, setCommentMarker, setMaximumLinesToRead, setRowFactoryClassName`

    - ### Methods inherited from class org.modeshape.jcr.api.sequencer.Sequencer

      `getAcceptedMimeTypes, getLogger, getName, getPathExpressions, getRepositoryName, getUniqueId, hasAcceptedMimeTypes, isAccepted, registerDefaultMimeTypes, registerNamespace, registerNodeTypes, registerNodeTypes, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FixedWidthTextSequencer

          public FixedWidthTextSequencer()

  - ### Method Detail

    - #### setColumnStartPositions

          public void setColumnStartPositions(int[] columnStartPositions)

      Set the column start positions. The column start positions are 0-based. Everything before the first start position is treated as the first column.

      As an example, if the column start positions were {3, 6, 15} and the incoming stream was:

                     1         2
           012345678901234567890
           supercallifragilistic
           expialidocious

      This sequencer would return the following rows:

           row 1: "sup", "erc", "allifragi", "listic"
           row 2: "exp:, "ial", "idocious"

      Note that there are only three columns returned in the second row, as there were not enough characters to reach the third start position.
      Parameters:
        `columnStartPositions` - the column startPositions; may not be null

    - #### setColumnStartPositions

          public void setColumnStartPositions(String commaDelimitedColumnStartPositions)

      Set the column start positions from a list of column start positions concatenated into a single, comma-delimited string.
      Parameters:
        `commaDelimitedColumnStartPositions` - a list of column start positions concatenated into a single, comma-delimited string; may not be null
      See Also:
        `setColumnStartPositions(int[])`

    - #### parseLine

          protected String[] parseLine(String line)

      Description copied from class: `AbstractTextSequencer`
      Parse the given row into its constituent columns.
      Specified by:
        `parseLine` in class `AbstractTextSequencer`
      Parameters:
        `line` - the row to be parsed
      Returns:
        an array of columns; never null

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.