cascading.scheme.util
Class DelimitedParser

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

public class DelimitedParser
extends java.lang.Object
implements java.io.Serializable

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

See Also:
TextDelimited, TextDelimited, Serialized Form

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

Field Detail

splitPattern

protected java.util.regex.Pattern splitPattern
Field splitPattern


cleanPattern

protected java.util.regex.Pattern cleanPattern
Field cleanPattern


escapePattern

protected java.util.regex.Pattern escapePattern
Field escapePattern

Constructor Detail

DelimitedParser

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

createEscapePatternFor

public static java.util.regex.Pattern createEscapePatternFor(java.lang.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 java.util.regex.Pattern createCleanPatternFor(java.lang.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 java.util.regex.Pattern createSplitPatternFor(java.lang.String delimiter,
                                                            java.lang.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 java.lang.String[] createSplit(java.lang.String value,
                                             java.util.regex.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 java.lang.Object[] cleanSplit(java.lang.Object[] split,
                                            java.util.regex.Pattern cleanPattern,
                                            java.util.regex.Pattern escapePattern,
                                            java.lang.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 java.lang.Object[] parseLine(java.lang.String line)

joinLine

public java.lang.Appendable joinLine(java.lang.Iterable iterable,
                                     java.lang.Appendable buffer)


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