org.apache.derby.impl.load
Class ExportWriteData

java.lang.Object
  extended by org.apache.derby.impl.load.ExportWriteDataAbstract
      extended by org.apache.derby.impl.load.ExportWriteData
All Implemented Interfaces:
java.security.PrivilegedExceptionAction

final class ExportWriteData
extends ExportWriteDataAbstract
implements java.security.PrivilegedExceptionAction


Field Summary
private  java.io.OutputStreamWriter aStream
           
private  byte[] byteBuf
           
private  char[] charBuf
           
private  java.io.ByteArrayOutputStream lobByteArrayStream
           
private  java.io.OutputStreamWriter lobCharStream
           
private  long lobFileOffset
           
private  java.io.BufferedOutputStream lobOutBinaryStream
           
private  java.lang.String lobsFileName
           
private  boolean lobsInExtFile
           
private  java.lang.String outputFileName
           
 
Fields inherited from class org.apache.derby.impl.load.ExportWriteDataAbstract
columnDefinition, columnLengths, controlFileReader, dataCodeset, dataLocale, doubleDelimiter, fieldSeparator, fieldStartDelimiter, fieldStopDelimiter, format, hasDelimiterAtEnd, nullString, recordSeparator
 
Constructor Summary
ExportWriteData(java.lang.String outputFileName, ControlInfo controlFileReader)
           
ExportWriteData(java.lang.String outputFileName, java.lang.String lobsFileName, ControlInfo controlFileReader)
           
 
Method Summary
private  void init()
           
private  java.lang.String makeDoubleDelimiterString(java.lang.String inputString, java.lang.String charDelimiter)
          Convert the input string into double delimiter format for export.
 void noMoreRows()
          if nothing more to write, then close the file and write a message of completion in message file
private  void openFiles()
           
 java.lang.Object run()
           
(package private)  java.lang.String writeBinaryColumnToExternalFile(java.io.InputStream istream)
          Writes the binary data in the given input stream to an external lob export file, and return it's location information in the file as string.
(package private)  java.lang.String writeCharColumnToExternalFile(java.io.Reader ir)
          Writes the clob data in the given input Reader to an external lob export file, and return it's location information in the file as string.
(package private)  void writeColumnDefinitionOptionally(java.lang.String[] columnNames, java.lang.String[] columnTypes)
          if control file says true for column definition, write it as first line of the data file
 void writeData(java.lang.String[] oneRow, boolean[] isNumeric)
          write the passed row into the data file
private  void writeNextColumn(java.lang.String oneColumn, boolean isNumeric)
           
 
Methods inherited from class org.apache.derby.impl.load.ExportWriteDataAbstract
loadPropertiesInfo, setColumnLengths
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputFileName

private java.lang.String outputFileName

lobsFileName

private java.lang.String lobsFileName

lobsInExtFile

private boolean lobsInExtFile

lobFileOffset

private long lobFileOffset

aStream

private java.io.OutputStreamWriter aStream

lobCharStream

private java.io.OutputStreamWriter lobCharStream

lobOutBinaryStream

private java.io.BufferedOutputStream lobOutBinaryStream

lobByteArrayStream

private java.io.ByteArrayOutputStream lobByteArrayStream

byteBuf

private byte[] byteBuf

charBuf

private char[] charBuf
Constructor Detail

ExportWriteData

ExportWriteData(java.lang.String outputFileName,
                ControlInfo controlFileReader)
          throws java.lang.Exception
Throws:
java.lang.Exception

ExportWriteData

ExportWriteData(java.lang.String outputFileName,
                java.lang.String lobsFileName,
                ControlInfo controlFileReader)
          throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

init

private void init()
           throws java.lang.Exception
Throws:
java.lang.Exception

run

public final java.lang.Object run()
                           throws java.lang.Exception
Specified by:
run in interface java.security.PrivilegedExceptionAction
Throws:
java.lang.Exception

openFiles

private void openFiles()
                throws java.lang.Exception
Throws:
java.lang.Exception

writeColumnDefinitionOptionally

void writeColumnDefinitionOptionally(java.lang.String[] columnNames,
                                     java.lang.String[] columnTypes)
                               throws java.lang.Exception
if control file says true for column definition, write it as first line of the data file

Specified by:
writeColumnDefinitionOptionally in class ExportWriteDataAbstract
Throws:
java.lang.Exception - if there is an error

writeNextColumn

private void writeNextColumn(java.lang.String oneColumn,
                             boolean isNumeric)
                      throws java.lang.Exception
Throws:
java.lang.Exception

writeBinaryColumnToExternalFile

java.lang.String writeBinaryColumnToExternalFile(java.io.InputStream istream)
                                           throws java.lang.Exception
Writes the binary data in the given input stream to an external lob export file, and return it's location information in the file as string. Location information is written in the main export file.

Specified by:
writeBinaryColumnToExternalFile in class ExportWriteDataAbstract
Parameters:
istream - input streams that contains a binary column data.
Returns:
Location where the column data written in the external file.
Throws:
java.lang.Exception - if any error occurs while writing the data.

writeCharColumnToExternalFile

java.lang.String writeCharColumnToExternalFile(java.io.Reader ir)
                                         throws java.lang.Exception
Writes the clob data in the given input Reader to an external lob export file, and return it's location information in the file as string. Location information is written in the main export file.

Specified by:
writeCharColumnToExternalFile in class ExportWriteDataAbstract
Parameters:
ir - Reader that contains a clob column data.
Returns:
Location where the column data written in the external file.
Throws:
java.lang.Exception - if any error occurs while writing the data.

writeData

public void writeData(java.lang.String[] oneRow,
                      boolean[] isNumeric)
               throws java.lang.Exception
write the passed row into the data file

Specified by:
writeData in class ExportWriteDataAbstract
Throws:
java.lang.Exception - if there is an error

noMoreRows

public void noMoreRows()
                throws java.io.IOException
if nothing more to write, then close the file and write a message of completion in message file

Specified by:
noMoreRows in class ExportWriteDataAbstract
Throws:
java.lang.Exception - if there is an error
java.io.IOException

makeDoubleDelimiterString

private java.lang.String makeDoubleDelimiterString(java.lang.String inputString,
                                                   java.lang.String charDelimiter)
Convert the input string into double delimiter format for export. double character delimiter recognition in delimited format files applies to the export and import utilities. Character delimiters are permitted within the character-based fields of a file. This applies to fields of type CHAR, VARCHAR, LONGVARCHAR, or CLOB. Any pair of character delimiters found between the enclosing character delimiters is imported into the database. For example with doble quote(") as character delimiter "What a ""nice""day!" will be imported as: What a "nice"day! In the case of export, the rule applies in reverse. For example, I am 6"tall. will be exported to a file as: "I am 6""tall."


Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.