Package hec.lang

Class RdcDelim

java.lang.Object
hec.lang.RdcDelim

public class RdcDelim extends Object
Title: Processes strings containing field separators like tab-delimited text files. The steps are: (1) Set the field separator (optional), (2) compute the fields by calling computeFields, (3) Get the field content by calling getFieldContent for the desired field. Description: Company:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected RdcField
    Field Object to contain parameters for one field
    protected String
    Working variable conatining the string of characters in the current field.
    protected int
    Number of fields found in input string.
    protected int
    Working variable containing the number of characters in the current field.
    protected int
    Number of characters in input string that will be parsed.
    protected Vector
    Contains and array of rdcField objects that for each field include beginning and ending character locations, number of characters in field, etc.
    protected String
    Contain separator characters that are used to determine breaks between fields.
    protected String
    Contain separator characters that are used to determine breaks between fields.
    protected String
    Input String that will be parsed.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an instance of a string parser for delimited fields.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Parse the entire input string
    void
    computeFields(StringBuffer stringIn, int firstCol, int length)
    Determine the fields for an input string "stringIn" starting at the specified first column (starting at zero) and ending after length characters.
    fieldContent(int ixField)
    Pass-through for old calls
    int
    firstCol(int ixField)
    Returns the first character position in the input string for field ixField, both position and field start at zero.
    int
    Returns the number of fields that were found.
    getFieldContent(int ixField)
    Returns the stringBuffer content from input string for field ixField where ixField starts at zero.
    char
    getFieldSeparator(int ixField)
    Returns the char separator that separated field ixField from the next field.
    Returns the string of character(s) that are used to parse for fields.
    Returns the string of character(s) that will be used to determine a string contained within quotes that will not be parsed.
    int
    lastCol(int ixField)
    Returns the last character position in the input string for field ixField, both position and field start at zero.
    int
    lengthField(int ixField)
    Returns the number of characters found in field ixField (0 through nfields-1).
    static void
    main(String[] args)
     
    void
     
    void
    rdcFields(StringBuffer stringIn, int firstCol, int length)
    Pass-through for old convention
    void
    Reset the RdcDelim Vector to be empty - it won't contain any elements.
    int
    setSeps(String theSeps)
    Set the field separator character(s) and returns the number of characters that were set.
    int
    setSepsQuote(String theSepsQ)
    Set the string of character(s) that will be used to determine a string contained within quotes that will not be parsed.
    int
    Returns the number of fields that were found.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • _rdcFields

      protected Vector _rdcFields
      Contains and array of rdcField objects that for each field include beginning and ending character locations, number of characters in field, etc.
    • _field

      protected RdcField _field
      Field Object to contain parameters for one field
    • _separators

      protected String _separators
      Contain separator characters that are used to determine breaks between fields.
    • _separatorQuote

      protected String _separatorQuote
      Contain separator characters that are used to determine breaks between fields.
    • _numberOfFields

      protected int _numberOfFields
      Number of fields found in input string.
    • _numCharIn_string

      protected int _numCharIn_string
      Number of characters in input string that will be parsed.
    • _string

      protected String _string
      Input String that will be parsed.
    • _numCharIn_fieldContent

      protected int _numCharIn_fieldContent
      Working variable containing the number of characters in the current field.
    • _fieldContent

      protected String _fieldContent
      Working variable conatining the string of characters in the current field.
  • Constructor Details

    • RdcDelim

      public RdcDelim()
      Create an instance of a string parser for delimited fields.
  • Method Details

    • reset

      public void reset()
      Reset the RdcDelim Vector to be empty - it won't contain any elements.
    • setSeps

      public int setSeps(String theSeps)
      Set the field separator character(s) and returns the number of characters that were set.
    • getSeps

      public String getSeps()
      Returns the string of character(s) that are used to parse for fields.
    • setSepsQuote

      public int setSepsQuote(String theSepsQ)
      Set the string of character(s) that will be used to determine a string contained within quotes that will not be parsed.
    • getSepsQuote

      public String getSepsQuote()
      Returns the string of character(s) that will be used to determine a string contained within quotes that will not be parsed.
    • getCountOfFields

      public int getCountOfFields()
      Returns the number of fields that were found. Deprecated.
    • size

      public int size()
      Returns the number of fields that were found. Replaces deprecated getCountOfFields.
      Returns:
    • lengthField

      public int lengthField(int ixField)
      Returns the number of characters found in field ixField (0 through nfields-1).
    • firstCol

      public int firstCol(int ixField)
      Returns the first character position in the input string for field ixField, both position and field start at zero.
    • lastCol

      public int lastCol(int ixField)
      Returns the last character position in the input string for field ixField, both position and field start at zero.
    • fieldContent

      public StringBuffer fieldContent(int ixField)
      Pass-through for old calls
    • getFieldContent

      public StringBuffer getFieldContent(int ixField)
      Returns the stringBuffer content from input string for field ixField where ixField starts at zero. Returns null if there is a failure to get the field content.
    • getFieldSeparator

      public char getFieldSeparator(int ixField)
      Returns the char separator that separated field ixField from the next field.
      Parameters:
      ixField - The field whose separator is wanted.
      Returns:
      The separator character.
    • rdcFields

      public void rdcFields(StringBuffer stringIn, int firstCol, int length)
      Pass-through for old convention
    • computeFields

      public void computeFields(StringBuffer stringIn)
      Parse the entire input string
    • computeFields

      public void computeFields(StringBuffer stringIn, int firstCol, int length)
      Determine the fields for an input string "stringIn" starting at the specified first column (starting at zero) and ending after length characters. This is the primary method for parsing an input string.
    • printFields

      public void printFields()
    • main

      public static void main(String[] args)