cascading.scheme.util
Class DelimitedParser

java.lang.Object
  extended by cascading.scheme.util.DelimitedParser
All Implemented Interfaces:
Serializable

public class DelimitedParser
extends Object
implements Serializable

Class DelimitedParser is not to be used directly but by platform specific Scheme implementations.

See Also:
TextDelimited, TextDelimited, Serialized Form

Field Summary
protected  Pattern cleanPattern
          Field cleanPattern
protected  Pattern escapePattern
          Field escapePattern
protected  Pattern splitPattern
          Field splitPattern
 
Constructor Summary
DelimitedParser(String delimiter, String quote, Class[] types, boolean strict, boolean safe, boolean skipHeader, Fields sourceFields, Fields sinkFields)
           
 
Method Summary
static Object[] cleanSplit(Object[] split, Pattern cleanPattern, Pattern escapePattern, String quote)
          Method cleanSplit will return a quote free array of String values, the given split array will be updated in place.
static Pattern createCleanPatternFor(String quote)
          Method createCleanPatternFor creates a regex Pattern for removing quote characters from a String.
static Pattern createEscapePatternFor(String quote)
          Method createEscapePatternFor creates a regex Pattern cleaning quote escapes from a String.
static String[] createSplit(String value, Pattern splitPattern, int numValues)
          Method createSplit will split the given value with the given splitPattern.
static Pattern createSplitPatternFor(String delimiter, String quote)
          Method createSplitPatternFor creates a regex Pattern for splitting a line of text into its component parts using the given delimiter and quote Strings.
 Appendable joinLine(Iterable iterable, Appendable buffer)
           
 Fields parseFirstLine(FlowProcess flowProcess, Tap tap)
           
 Object[] parseLine(String line)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

splitPattern

protected Pattern splitPattern
Field splitPattern


cleanPattern

protected Pattern cleanPattern
Field cleanPattern


escapePattern

protected Pattern escapePattern
Field escapePattern

Constructor Detail

DelimitedParser

public DelimitedParser(String delimiter,
                       String quote,
                       Class[] types,
                       boolean strict,
                       boolean safe,
                       boolean skipHeader,
                       Fields sourceFields,
                       Fields sinkFields)
Method Detail

createEscapePatternFor

public static Pattern createEscapePatternFor(String quote)
Method createEscapePatternFor creates a regex Pattern cleaning quote escapes from a String.

If quote is null or empty, a null value will be returned;

Parameters:
quote - of type String
Returns:
Pattern

createCleanPatternFor

public static Pattern createCleanPatternFor(String quote)
Method createCleanPatternFor creates a regex Pattern for removing quote characters from a String.

If quote is null or empty, a null value will be returned;

Parameters:
quote - of type String
Returns:
Pattern

createSplitPatternFor

public static Pattern createSplitPatternFor(String delimiter,
                                            String quote)
Method createSplitPatternFor creates a regex Pattern for splitting a line of text into its component parts using the given delimiter and quote Strings. quote may be null.

Parameters:
delimiter - of type String
quote - of type String
Returns:
Pattern

createSplit

public static String[] createSplit(String value,
                                   Pattern splitPattern,
                                   int numValues)
Method createSplit will split the given value with the given splitPattern.

Parameters:
value - of type String
splitPattern - of type Pattern
numValues - of type int
Returns:
String[]

cleanSplit

public static Object[] cleanSplit(Object[] split,
                                  Pattern cleanPattern,
                                  Pattern escapePattern,
                                  String quote)
Method cleanSplit will return a quote free array of String values, the given split array will be updated in place.

If cleanPattern is null, quote cleaning will not be performed, but all empty String values will be replaces with a null value.

Parameters:
split - of type Object[]
cleanPattern - of type Pattern
escapePattern - of type Pattern
quote - of type String
Returns:
Object[] as a convenience

parseFirstLine

public Fields parseFirstLine(FlowProcess flowProcess,
                             Tap tap)

parseLine

public Object[] parseLine(String line)

joinLine

public Appendable joinLine(Iterable iterable,
                           Appendable buffer)


Copyright © 2007-2012 Concurrent, Inc. All Rights Reserved.