This project has retired. For details please refer to its Attic page.
DelimiterSet (Sqoop 1.4.3 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 char NULL_CHAR
           
 
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
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