Class HandlerArrayFromFixed
java.lang.Object
us.irdev.bedrock.bag.entry.Handler
us.irdev.bedrock.bag.entry.HandlerComposite
us.irdev.bedrock.bag.entry.HandlerArrayFromFixed
-
Field Summary
Fields inherited from class us.irdev.bedrock.bag.entry.HandlerComposite
handler
-
Constructor Summary
ConstructorDescriptionHandlerArrayFromFixed
(int[][] fields) HandlerArrayFromFixed
(int[][] fields, Handler handler) -
Method Summary
Modifier and TypeMethodDescriptionstatic int[][]
fieldsFromExemplar
(String exemplar, char separator) 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)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)
-
Constructor Details
-
HandlerArrayFromFixed
public HandlerArrayFromFixed(int[][] fields) -
HandlerArrayFromFixed
- 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
- Parameters:
exemplar
- a string representing an example record to extract the positions from, where positions are identified every time the exemplar value changesseparator
- a character that represents an ignored region of the data line- Returns:
- a two dimensional array of start and end positions for tokens
-
getEntry
-