net.sourceforge.jdbcimporter.parser
Class PatternDelimiterParser

java.lang.Object
  extended bynet.sourceforge.jdbcimporter.parser.PatternDelimiterParser
All Implemented Interfaces:
DelimiterParser

public class PatternDelimiterParser
extends java.lang.Object
implements DelimiterParser

The PatternDelimiterParser class implements the DelimiterParser interface to parse column values based on a java.text.MessageFormat pattern. It uses a custom Format class that includes several enhancements. The first column value will be parsed from the string where '{1}' is found in the pattern.

Version:
0.61
Author:
Chris Nagy
See Also:
CustomMessageFormat

Constructor Summary
PatternDelimiterParser()
           
 
Method Summary
 java.lang.String getNextRow()
          Returns the next row to be imported as a String.
 ColumnValue[] getValues(java.lang.String nextRow)
          Returns the column values for the row specified.
 void setPattern(java.lang.String pattern)
          Sets the pattern to use when parsing values.
 void setReader(java.io.Reader input)
          Sets the input source for the parser.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternDelimiterParser

public PatternDelimiterParser()
Method Detail

setReader

public void setReader(java.io.Reader input)
Description copied from interface: DelimiterParser
Sets the input source for the parser.

Specified by:
setReader in interface DelimiterParser
Parameters:
input - the source of the data to import.
See Also:
DelimiterParser.setReader(java.io.Reader)

setPattern

public void setPattern(java.lang.String pattern)
Sets the pattern to use when parsing values.

Parameters:
pattern - the pattern

getNextRow

public java.lang.String getNextRow()
                            throws java.io.IOException
Description copied from interface: DelimiterParser
Returns the next row to be imported as a String.

Specified by:
getNextRow in interface DelimiterParser
Returns:
the next row to import
Throws:
java.io.IOException - if an error occurs while retrieving the next row
See Also:
DelimiterParser.getNextRow()

getValues

public ColumnValue[] getValues(java.lang.String nextRow)
                        throws MalformedDataException
Description copied from interface: DelimiterParser
Returns the column values for the row specified.

Specified by:
getValues in interface DelimiterParser
Parameters:
nextRow - the row to be parsed into column values
Returns:
the column values
Throws:
MalformedDataException - if the row is not formatted properly
See Also:
DelimiterParser.getValues(java.lang.String)