This project has retired. For details please refer to its Attic page.
DelimiterSet (Sqoop 1.4.4 API)

org.apache.sqoop.lib
Class DelimiterSet

java.lang.Object
  extended by org.apache.sqoop.lib.DelimiterSet
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
DelimiterSet

public class DelimiterSet
extends java.lang.Object
implements java.lang.Cloneable

Encapsulates a set of delimiters used to encode a record.


Field Summary
static java.lang.String INPUT_ENCLOSE_REQUIRED_KEY
           
static java.lang.String INPUT_ENCLOSED_BY_KEY
           
static java.lang.String INPUT_ESCAPED_BY_KEY
           
static java.lang.String INPUT_FIELD_DELIM_KEY
          Create the input variations for export instead of overloading them.
static java.lang.String INPUT_RECORD_DELIM_KEY
           
static char NULL_CHAR
           
static java.lang.String OUTPUT_ENCLOSE_REQUIRED_KEY
           
static java.lang.String OUTPUT_ENCLOSED_BY_KEY
           
static java.lang.String OUTPUT_ESCAPED_BY_KEY
           
static java.lang.String OUTPUT_FIELD_DELIM_KEY
           
static java.lang.String OUTPUT_RECORD_DELIM_KEY
           
 
Constructor Summary
DelimiterSet()
          Create a delimiter set with the default delimiters (comma for fields, newline for records).
DelimiterSet(char field, char record, char enclose, char escape, boolean isEncloseRequired)
          Create a delimiter set with the specified delimiters.
 
Method Summary
 java.lang.Object clone()
           
 DelimiterSet copy()
          Identical to clone() but does not throw spurious exceptions.
 boolean equals(java.lang.Object other)
           
 java.lang.String formatConstructor()
          Format this set of delimiters as a call to the constructor for this object, that would generate identical delimiters.
 char getEnclosedBy()
           
 char getEscapedBy()
           
 char getFieldsTerminatedBy()
           
 char getLinesTerminatedBy()
           
 int hashCode()
           
 boolean isEncloseRequired()
           
 void setEnclosedBy(char e)
          Sets the enclosed-by character.
 void setEncloseRequired(boolean required)
          Set whether the enclosed-by character must be applied to all fields, or only fields with embedded delimiters.
 void setEscapedBy(char e)
          Sets the escaped-by character.
 void setFieldsTerminatedBy(char f)
          Sets the fields-terminated-by character.
 void setLinesTerminatedBy(char r)
          Sets the end-of-record lines-terminated-by character.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL_CHAR

public static final char NULL_CHAR
See Also:
Constant Field Values

OUTPUT_FIELD_DELIM_KEY

public static final java.lang.String OUTPUT_FIELD_DELIM_KEY
See Also:
Constant Field Values

OUTPUT_RECORD_DELIM_KEY

public static final java.lang.String OUTPUT_RECORD_DELIM_KEY
See Also:
Constant Field Values

OUTPUT_ENCLOSED_BY_KEY

public static final java.lang.String OUTPUT_ENCLOSED_BY_KEY
See Also:
Constant Field Values

OUTPUT_ESCAPED_BY_KEY

public static final java.lang.String OUTPUT_ESCAPED_BY_KEY
See Also:
Constant Field Values

OUTPUT_ENCLOSE_REQUIRED_KEY

public static final java.lang.String OUTPUT_ENCLOSE_REQUIRED_KEY
See Also:
Constant Field Values

INPUT_FIELD_DELIM_KEY

public static final java.lang.String INPUT_FIELD_DELIM_KEY
Create the input variations for export instead of overloading them.

See Also:
Constant Field Values

INPUT_RECORD_DELIM_KEY

public static final java.lang.String INPUT_RECORD_DELIM_KEY
See Also:
Constant Field Values

INPUT_ENCLOSED_BY_KEY

public static final java.lang.String INPUT_ENCLOSED_BY_KEY
See Also:
Constant Field Values

INPUT_ESCAPED_BY_KEY

public static final java.lang.String INPUT_ESCAPED_BY_KEY
See Also:
Constant Field Values

INPUT_ENCLOSE_REQUIRED_KEY

public static final java.lang.String INPUT_ENCLOSE_REQUIRED_KEY
See Also:
Constant Field Values
Constructor Detail

DelimiterSet

public DelimiterSet()
Create a delimiter set with the default delimiters (comma for fields, newline for records).


DelimiterSet

public DelimiterSet(char field,
                    char record,
                    char enclose,
                    char escape,
                    boolean isEncloseRequired)
Create a delimiter set with the specified delimiters.

Parameters:
field - the fields-terminated-by delimiter
record - the lines-terminated-by delimiter
enclose - the enclosed-by character
escape - the escaped-by character
isEncloseRequired - If true, enclosed-by is applied to all fields. If false, only applied to fields that embed delimiters.
Method Detail

copy

public DelimiterSet copy()
Identical to clone() but does not throw spurious exceptions.

Returns:
a new copy of this same set of delimiters.

setFieldsTerminatedBy

public void setFieldsTerminatedBy(char f)
Sets the fields-terminated-by character.


getFieldsTerminatedBy

public char getFieldsTerminatedBy()
Returns:
the fields-terminated-by character.

setLinesTerminatedBy

public void setLinesTerminatedBy(char r)
Sets the end-of-record lines-terminated-by character.


getLinesTerminatedBy

public char getLinesTerminatedBy()
Returns:
the end-of-record (lines-terminated-by) character.

setEnclosedBy

public void setEnclosedBy(char e)
Sets the enclosed-by character.

Parameters:
e - the enclosed-by character, or '\000' for no enclosing character.

getEnclosedBy

public char getEnclosedBy()
Returns:
the enclosed-by character, or '\000' for none.

setEscapedBy

public void setEscapedBy(char e)
Sets the escaped-by character.

Parameters:
e - the escaped-by character, or '\000' for no escape character.

getEscapedBy

public char getEscapedBy()
Returns:
the escaped-by character, or '\000' for none.

setEncloseRequired

public void setEncloseRequired(boolean required)
Set whether the enclosed-by character must be applied to all fields, or only fields with embedded delimiters.


isEncloseRequired

public boolean isEncloseRequired()
Returns:
true if the enclosed-by character must be applied to all fields, or false if it's only used for fields with embedded delimiters.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

formatConstructor

public java.lang.String formatConstructor()
Format this set of delimiters as a call to the constructor for this object, that would generate identical delimiters.

Returns:
a String that can be embedded in generated code that provides this set of delimiters.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException


Copyright © 2013 The Apache Software Foundation