Class ExportWriteData

java.lang.Object
org.apache.derby.impl.load.ExportWriteDataAbstract
org.apache.derby.impl.load.ExportWriteData
All Implemented Interfaces:
PrivilegedExceptionAction<Object>

final class ExportWriteData extends ExportWriteDataAbstract implements PrivilegedExceptionAction<Object>
  • Field Details

    • outputFileName

      private String outputFileName
    • lobsFileName

      private String lobsFileName
    • lobsInExtFile

      private boolean lobsInExtFile
    • lobFileOffset

      private long lobFileOffset
    • aStream

      private OutputStreamWriter aStream
    • lobCharStream

      private OutputStreamWriter lobCharStream
    • lobOutBinaryStream

      private BufferedOutputStream lobOutBinaryStream
    • lobByteArrayStream

      private ByteArrayOutputStream lobByteArrayStream
    • byteBuf

      private byte[] byteBuf
    • charBuf

      private char[] charBuf
  • Constructor Details

  • Method Details

    • init

      private void init() throws Exception
      Throws:
      Exception
    • run

      public final Object run() throws Exception
      Specified by:
      run in interface PrivilegedExceptionAction<Object>
      Throws:
      Exception
    • openFiles

      private void openFiles() throws Exception
      Throws:
      Exception
    • writeColumnDefinitionOptionally

      void writeColumnDefinitionOptionally(String[] columnNames, String[] columnTypes) throws 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:
      Exception - if there is an error
    • writeNextColumn

      private void writeNextColumn(String oneColumn, boolean isNumeric) throws Exception
      Throws:
      Exception
    • writeBinaryColumnToExternalFile

      String writeBinaryColumnToExternalFile(InputStream istream) throws 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:
      Exception - if any error occurs while writing the data.
    • writeCharColumnToExternalFile

      String writeCharColumnToExternalFile(Reader ir) throws 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:
      Exception - if any error occurs while writing the data.
    • writeData

      public void writeData(String[] oneRow, boolean[] isNumeric) throws Exception
      write the passed row into the data file
      Specified by:
      writeData in class ExportWriteDataAbstract
      Throws:
      Exception - if there is an error
    • noMoreRows

      public void noMoreRows() throws 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:
      Exception - if there is an error
      IOException
    • makeDoubleDelimiterString

      private String makeDoubleDelimiterString(String inputString, 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."