Class HandlerArrayFromFixed


public class HandlerArrayFromFixed extends HandlerComposite
  • Constructor Details

    • HandlerArrayFromFixed

      public HandlerArrayFromFixed(int[][] fields)
    • HandlerArrayFromFixed

      public HandlerArrayFromFixed(int[][] fields, Handler handler)
      Parameters:
      fields - an array of field descriptions, where each field description is a 2 element array (start and end - not inclusive)
      handler -
  • Method Details

    • fieldsFromPositions

      public static int[][] fieldsFromPositions(int offset, int... positions)
      this method returns a field description array given a set of positions (assuming there are no pads in the intended string)
      Parameters:
      offset - The relative offset of the beginning of the line compared to the offsets in 'positions'. I find it easier to use my text editor to identify positions, and it counts the first column as '1', so I can set 'first' = 1, and then use the column number of the rest of the fields as reported by my text editor.
      positions - An array of numbers indicating positions of fields in the data lines, starting at the first field.
      Returns:
      a two dimensional array of start and end positions for tokens
    • fieldsFromWidths

      public static int[][] fieldsFromWidths(int... widths)
      this method returns a field description array given a set of widths (assuming there are no pads in the intended string)
      Parameters:
      widths - an array of numbers indicating the width of each field
      Returns:
      a two dimensional array of start and end positions for tokens
    • fieldsFromExemplar

      public static int[][] fieldsFromExemplar(String exemplar, char separator)
      Parameters:
      exemplar - a string representing an example record to extract the positions from, where positions are identified every time the exemplar value changes
      separator - a character that represents an ignored region of the data line
      Returns:
      a two dimensional array of start and end positions for tokens
    • getEntry

      public Object getEntry(String input)
      Specified by:
      getEntry in class Handler