Class ImportReadData

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

final class ImportReadData extends Object implements PrivilegedExceptionAction<Object>
  • Field Details

    • inputFileName

      private String inputFileName
    • skipLines

      private short skipLines
    • columnWidths

      private int[] columnWidths
    • rowWidth

      private int rowWidth
    • tempString

      private char[] tempString
    • numberOfCharsReadSoFar

      private int numberOfCharsReadSoFar
    • bufferedReader

      private BufferedReader bufferedReader
    • START_SIZE

      private static final int START_SIZE
      See Also:
    • currentToken

      private char[] currentToken
    • currentTokenMaxSize

      private int currentTokenMaxSize
    • foundStartDelimiter

      boolean foundStartDelimiter
    • totalCharsSoFar

      int totalCharsSoFar
    • positionOfNonWhiteSpaceCharInFront

      int positionOfNonWhiteSpaceCharInFront
    • positionOfNonWhiteSpaceCharInBack

      int positionOfNonWhiteSpaceCharInBack
    • lineNumber

      int lineNumber
    • fieldStartDelimiterIndex

      int fieldStartDelimiterIndex
    • fieldStopDelimiterIndex

      int fieldStopDelimiterIndex
    • stopDelimiterPosition

      int stopDelimiterPosition
    • foundStartAndStopDelimiters

      boolean foundStartAndStopDelimiters
    • streamOpenForReading

      boolean streamOpenForReading
    • DEFAULT_FORMAT_CODE

      static final int DEFAULT_FORMAT_CODE
      See Also:
    • ASCII_FIXED_FORMAT_CODE

      static final int ASCII_FIXED_FORMAT_CODE
      See Also:
    • formatCode

      private int formatCode
    • hasColumnDefinition

      private boolean hasColumnDefinition
    • recordSeparatorChar0

      private char recordSeparatorChar0
    • fieldSeparatorChar0

      private char fieldSeparatorChar0
    • recordSepStartNotWhite

      private boolean recordSepStartNotWhite
    • fieldSepStartNotWhite

      private boolean fieldSepStartNotWhite
    • controlFileReader

      protected ControlInfo controlFileReader
    • numberOfColumns

      protected int numberOfColumns
    • columnTypes

      protected String[] columnTypes
    • fieldSeparator

      protected char[] fieldSeparator
    • fieldSeparatorLength

      protected int fieldSeparatorLength
    • recordSeparator

      protected char[] recordSeparator
    • recordSeparatorLength

      protected int recordSeparatorLength
    • nullString

      protected String nullString
    • columnDefinition

      protected String columnDefinition
    • format

      protected String format
    • dataCodeset

      protected String dataCodeset
    • fieldStartDelimiter

      protected char[] fieldStartDelimiter
    • fieldStartDelimiterLength

      protected int fieldStartDelimiterLength
    • fieldStopDelimiter

      protected char[] fieldStopDelimiter
    • fieldStopDelimiterLength

      protected int fieldStopDelimiterLength
    • hasDelimiterAtEnd

      protected boolean hasDelimiterAtEnd
    • lobFileHandles

      private ImportLobFile[] lobFileHandles
    • lobFileName

      private String lobFileName
    • lobOffset

      private long lobOffset
    • lobLength

      private int lobLength
    • haveSep

      private boolean haveSep
  • Constructor Details

  • Method Details

    • loadPropertiesInfo

      private void loadPropertiesInfo() throws Exception
      Throws:
      Exception
    • getNumberOfColumns

      int getNumberOfColumns()
    • ignoreFirstRow

      protected void ignoreFirstRow() throws Exception
      if columndefinition is true, ignore first row. The way to do that is to just look for the record separator
      Throws:
      Exception - if there is an error
    • ignoreHeaderLines

      protected void ignoreHeaderLines() throws Exception
      if skipHeaderLines is greater than 0, ignore skipHeaderLines number of lines. The way to do that is to just look for the record separator
      Throws:
      Exception - if there is an error
    • loadColumnTypes

      protected void loadColumnTypes() throws Exception
      load the column types from the meta data line to be analyzed later in the constructor of the ImportResultSetMetaData.
      Throws:
      Exception
    • openFile

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

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

      private void realOpenFile() throws Exception
      Throws:
      Exception
    • loadMetaData

      private void loadMetaData() throws Exception
      Throws:
      Exception
    • closeStream

      void closeStream() throws Exception
      close the input data file
      Throws:
      Exception - if there is an error
    • findNumberOfColumnsInARow

      int findNumberOfColumnsInARow() throws Exception
      Throws:
      Exception
    • checkForWhiteSpaceInFront

      private void checkForWhiteSpaceInFront()
    • checkForWhiteSpaceInBack

      private void checkForWhiteSpaceInBack()
    • readTokensUntilEndOfRecord

      boolean readTokensUntilEndOfRecord() throws Exception
      Throws:
      Exception
    • lookForPassedSeparator

      private int lookForPassedSeparator(char[] delimiter, int delimiterIndex, int delimiterLength, int nextChar, boolean lookForRecordSeperator) throws IOException
      Throws:
      IOException
    • reCheckRestOfTheCharacters

      private int reCheckRestOfTheCharacters(int startFrom, char[] delimiter, int delimiterLength)
    • skipDoubleDelimiters

      private boolean skipDoubleDelimiters(char[] characterDelimiter) throws IOException
      Throws:
      IOException
    • omitLineFeed

      private void omitLineFeed() throws IOException
      Throws:
      IOException
    • getCurrentRowNumber

      int getCurrentRowNumber()
      returns the number of the current row
    • readNextRow

      boolean readNextRow(String[] returnStringArray) throws Exception
      the way we read the next row from input file depends on it's format
      Throws:
      Exception - if there is an error
    • readNextFixedRow

      private boolean readNextFixedRow(String[] returnStringArray) throws Exception
      Throws:
      Exception
    • readNextDelimitedRow

      private boolean readNextDelimitedRow(String[] returnStringArray) throws Exception
      Throws:
      Exception
    • isFieldSep

      private boolean isFieldSep(char[] chrArray)
    • readNextToken

      boolean readNextToken(char[] delimiter, int delimiterIndex, int delimiterLength, boolean isRecordSeperator) throws Exception
      Throws:
      Exception
    • getClobColumnFromExtFileAsString

      String getClobColumnFromExtFileAsString(String lobLocationStr, int colIndex) throws SQLException
      Returns a clob columnn data stored at the specified location.
      Parameters:
      lobLocationStr - location of the clob data.
      colIndex - number of the column. starts at 1.
      Throws:
      SQLException - on any errors.
    • getClobColumnFromExtFile

      Clob getClobColumnFromExtFile(String lobLocationStr, int colIndex) throws SQLException
      Returns a clob columnn data stored at the specified location as a java.sql.Clob object.
      Parameters:
      lobLocationStr - location of the clob data.
      colIndex - number of the column. starts at 1.
      Throws:
      SQLException - on any errors.
    • getBlobColumnFromExtFile

      Blob getBlobColumnFromExtFile(String lobLocationStr, int colIndex) throws SQLException
      Returns a blob columnn data stored at the specified location as a java.sql.Blob object.
      Parameters:
      lobLocationStr - location of the clob data.
      colIndex - number of the column. starts at 1.
      Throws:
      SQLException - on any errors.
    • initExternalLobFile

      private void initExternalLobFile(String lobLocationStr, int colIndex) throws SQLException
      Extract the file name, offset and length from the given lob location and setup the file resources to read the data from the file on first invocaton.
      Parameters:
      lobLocationStr - location of the clob data.
      colIndex - number of the column. starts at 1.
      Throws:
      SQLException - on any errors.