com.cloudera.sqoop.io
Class LobFile.Writer

java.lang.Object
  extended by com.cloudera.sqoop.io.LobFile.Writer
All Implemented Interfaces:
java.io.Closeable
Enclosing class:
LobFile

public abstract static class LobFile.Writer
extends java.lang.Object
implements java.io.Closeable

Class that writes out a LobFile. Instantiate via LobFile.create().


Constructor Summary
LobFile.Writer()
           
 
Method Summary
protected  void checkForNull(java.io.OutputStream out)
          Checks whether an underlying stream is present or null.
abstract  void close()
          Finishes writing the LobFile and closes underlying handles.
protected  void finalize()
           
abstract  void finishRecord()
          Terminates the current record and writes any trailing zero-padding required by the specified record size.
abstract  org.apache.hadoop.fs.Path getPath()
          If this Writer is writing to a physical LobFile, then this returns the file path it is writing to.
abstract  long tell()
          Report the current position in the output file.
abstract  java.io.OutputStream writeBlobRecord(long len)
          Declares a new BLOB record to be written to the file.
abstract  java.io.Writer writeClobRecord(long len)
          Declares a new CLOB record to be written to the file.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LobFile.Writer

public LobFile.Writer()
Method Detail

getPath

public abstract org.apache.hadoop.fs.Path getPath()
If this Writer is writing to a physical LobFile, then this returns the file path it is writing to. Otherwise it returns null.

Returns:
the fully-qualified path being written to by this writer.

close

public abstract void close()
                    throws java.io.IOException
Finishes writing the LobFile and closes underlying handles.

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

finishRecord

public abstract void finishRecord()
                           throws java.io.IOException
Terminates the current record and writes any trailing zero-padding required by the specified record size. This is implicitly called between consecutive writeBlobRecord() / writeClobRecord() calls.

Throws:
java.io.IOException

writeBlobRecord

public abstract java.io.OutputStream writeBlobRecord(long len)
                                              throws java.io.IOException
Declares a new BLOB record to be written to the file.

Parameters:
len - the "claimed" number of bytes that will be written to this record. The actual number of bytes may differ.
Throws:
java.io.IOException

writeClobRecord

public abstract java.io.Writer writeClobRecord(long len)
                                        throws java.io.IOException
Declares a new CLOB record to be written to the file.

Parameters:
len - the claimed number of characters that will be written to this record. The actual number of characters may differ.
Throws:
java.io.IOException

tell

public abstract long tell()
                   throws java.io.IOException
Report the current position in the output file.

Returns:
the number of bytes written through this Writer.
Throws:
java.io.IOException

checkForNull

protected void checkForNull(java.io.OutputStream out)
                     throws java.io.IOException
Checks whether an underlying stream is present or null.

Parameters:
out - the stream to check for null-ness.
Throws:
java.io.IOException - if out is null.


Copyright © 2010 Cloudera, Inc.