org.apache.sqoop.lib
Class ClobRef

java.lang.Object
  extended by org.apache.sqoop.lib.LobRef<DATATYPE,CONTAINERTYPE,ACCESSORTYPE>
      extended by com.cloudera.sqoop.lib.LobRef<java.lang.String,java.lang.String,java.io.Reader>
          extended by org.apache.sqoop.lib.ClobRef
All Implemented Interfaces:
java.io.Closeable, org.apache.hadoop.io.Writable
Direct Known Subclasses:
ClobRef

public class ClobRef
extends LobRef<java.lang.String,java.lang.String,java.io.Reader>

ClobRef is a wrapper that holds a CLOB either directly, or a reference to a file that holds the CLOB data.


Field Summary
 
Fields inherited from class com.cloudera.sqoop.lib.LobRef
EXTERNAL_MATCHER, LOG
 
Constructor Summary
ClobRef()
           
ClobRef(java.lang.String chars)
           
ClobRef(java.lang.String file, long offset, long length)
          Initialize a clobref to an external CLOB.
 
Method Summary
protected  java.lang.String deepCopyData(java.lang.String data)
          Make a copy of the materialized data.
protected  java.io.Reader getExternalSource(com.cloudera.sqoop.io.LobFile.Reader reader)
          Using the LobFile reader, get an accessor InputStream or Reader to the underlying data.
protected  java.lang.String getInternalData(java.lang.String data)
           
protected  java.io.Reader getInternalSource(java.lang.String data)
          Wrap the materialized data in an InputStream or Reader.
static ClobRef parse(java.lang.String inputString)
          Create a ClobRef based on parsed data from a line of text.
 void readFieldsInternal(java.io.DataInput in)
          Perform the readFields() operation on a fully-materializable record.
 void writeInternal(java.io.DataOutput out)
          Perform the write() operation on a fully-materializable record.
 
Methods inherited from class org.apache.sqoop.lib.LobRef
clone, close, finalize, getData, getDataObj, getDataStream, getDataStream, isExternal, readFields, setDataObj, toString, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClobRef

public ClobRef()

ClobRef

public ClobRef(java.lang.String chars)

ClobRef

public ClobRef(java.lang.String file,
               long offset,
               long length)
Initialize a clobref to an external CLOB.

Parameters:
file - the filename to the CLOB. May be relative to the job dir.
offset - the offset (in bytes) into the LobFile for this record.
length - the length of the record in characters.
Method Detail

getExternalSource

protected java.io.Reader getExternalSource(com.cloudera.sqoop.io.LobFile.Reader reader)
                                    throws java.io.IOException
Description copied from class: LobRef
Using the LobFile reader, get an accessor InputStream or Reader to the underlying data.

Specified by:
getExternalSource in class LobRef<java.lang.String,java.lang.String,java.io.Reader>
Throws:
java.io.IOException

getInternalSource

protected java.io.Reader getInternalSource(java.lang.String data)
Description copied from class: LobRef
Wrap the materialized data in an InputStream or Reader.

Specified by:
getInternalSource in class LobRef<java.lang.String,java.lang.String,java.io.Reader>

deepCopyData

protected java.lang.String deepCopyData(java.lang.String data)
Description copied from class: LobRef
Make a copy of the materialized data.

Specified by:
deepCopyData in class LobRef<java.lang.String,java.lang.String,java.io.Reader>

getInternalData

protected java.lang.String getInternalData(java.lang.String data)
Specified by:
getInternalData in class LobRef<java.lang.String,java.lang.String,java.io.Reader>
Returns:
the materialized data itself.

readFieldsInternal

public void readFieldsInternal(java.io.DataInput in)
                        throws java.io.IOException
Description copied from class: LobRef
Perform the readFields() operation on a fully-materializable record.

Specified by:
readFieldsInternal in class LobRef<java.lang.String,java.lang.String,java.io.Reader>
Parameters:
in - the DataInput to deserialize from.
Throws:
java.io.IOException

writeInternal

public void writeInternal(java.io.DataOutput out)
                   throws java.io.IOException
Description copied from class: LobRef
Perform the write() operation on a fully-materializable record.

Specified by:
writeInternal in class LobRef<java.lang.String,java.lang.String,java.io.Reader>
Parameters:
out - the DataOutput to deserialize to.
Throws:
java.io.IOException

parse

public static ClobRef parse(java.lang.String inputString)
Create a ClobRef based on parsed data from a line of text.

Parameters:
inputString - the text-based input data to parse.
Returns:
a ClobRef to the given data.


Copyright © 2011 The Apache Software Foundation