Package org.apache.sqoop.lib
Class BlobRef
- java.lang.Object
-
- org.apache.sqoop.lib.LobRef<byte[],org.apache.hadoop.io.BytesWritable,java.io.InputStream>
-
- org.apache.sqoop.lib.BlobRef
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,org.apache.hadoop.io.Writable
public class BlobRef extends LobRef<byte[],org.apache.hadoop.io.BytesWritable,java.io.InputStream>
BlobRef is a wrapper that holds a BLOB either directly, or a reference to a file that holds the BLOB data.
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.commons.logging.LogLOG-
Fields inherited from class org.apache.sqoop.lib.LobRef
EXTERNAL_MATCHER
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.hadoop.io.BytesWritabledeepCopyData(org.apache.hadoop.io.BytesWritable data)Make a copy of the materialized data.protected java.io.InputStreamgetExternalSource(org.apache.sqoop.io.LobFile.Reader reader)Using the LobFile reader, get an accessor InputStream or Reader to the underlying data.protected byte[]getInternalData(org.apache.hadoop.io.BytesWritable data)protected java.io.InputStreamgetInternalSource(org.apache.hadoop.io.BytesWritable data)Wrap the materialized data in an InputStream or Reader.static BlobRefparse(java.lang.String inputString)Create a BlobRef based on parsed data from a line of text.voidreadFieldsInternal(java.io.DataInput in)Perform the readFields() operation on a fully-materializable record.voidwriteInternal(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
-
-
-
-
Constructor Detail
-
BlobRef
public BlobRef()
-
BlobRef
public BlobRef(byte[] bytes)
-
BlobRef
public BlobRef(java.lang.String file, long offset, long length)Initialize a BlobRef to an external BLOB.- Parameters:
file- the filename to the BLOB. 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 bytes.
-
-
Method Detail
-
getExternalSource
protected java.io.InputStream getExternalSource(org.apache.sqoop.io.LobFile.Reader reader) throws java.io.IOExceptionDescription copied from class:LobRefUsing the LobFile reader, get an accessor InputStream or Reader to the underlying data.- Specified by:
getExternalSourcein classLobRef<byte[],org.apache.hadoop.io.BytesWritable,java.io.InputStream>- Throws:
java.io.IOException
-
getInternalSource
protected java.io.InputStream getInternalSource(org.apache.hadoop.io.BytesWritable data)
Description copied from class:LobRefWrap the materialized data in an InputStream or Reader.- Specified by:
getInternalSourcein classLobRef<byte[],org.apache.hadoop.io.BytesWritable,java.io.InputStream>
-
getInternalData
protected byte[] getInternalData(org.apache.hadoop.io.BytesWritable data)
- Specified by:
getInternalDatain classLobRef<byte[],org.apache.hadoop.io.BytesWritable,java.io.InputStream>- Returns:
- the materialized data itself.
-
deepCopyData
protected org.apache.hadoop.io.BytesWritable deepCopyData(org.apache.hadoop.io.BytesWritable data)
Description copied from class:LobRefMake a copy of the materialized data.- Specified by:
deepCopyDatain classLobRef<byte[],org.apache.hadoop.io.BytesWritable,java.io.InputStream>
-
readFieldsInternal
public void readFieldsInternal(java.io.DataInput in) throws java.io.IOExceptionDescription copied from class:LobRefPerform the readFields() operation on a fully-materializable record.- Specified by:
readFieldsInternalin classLobRef<byte[],org.apache.hadoop.io.BytesWritable,java.io.InputStream>- Parameters:
in- the DataInput to deserialize from.- Throws:
java.io.IOException
-
writeInternal
public void writeInternal(java.io.DataOutput out) throws java.io.IOExceptionDescription copied from class:LobRefPerform the write() operation on a fully-materializable record.- Specified by:
writeInternalin classLobRef<byte[],org.apache.hadoop.io.BytesWritable,java.io.InputStream>- Parameters:
out- the DataOutput to deserialize to.- Throws:
java.io.IOException
-
parse
public static BlobRef parse(java.lang.String inputString)
Create a BlobRef based on parsed data from a line of text. This only operates correctly on external blobs; inline blobs are simply returned as null. You should store BLOB data in SequenceFile format if reparsing is necessary.- Parameters:
inputString- the text-based input data to parse.- Returns:
- a new BlobRef containing a reference to an external BLOB, or an empty BlobRef if the data to be parsed is actually inline.
-
-