Class ImportReadData

  • All Implemented Interfaces:
    java.security.PrivilegedExceptionAction<java.lang.Object>

    final class ImportReadData
    extends java.lang.Object
    implements java.security.PrivilegedExceptionAction<java.lang.Object>
    • Field Detail

      • inputFileName

        private java.lang.String inputFileName
      • skipLines

        private short skipLines
      • columnWidths

        private int[] columnWidths
      • rowWidth

        private int rowWidth
      • tempString

        private char[] tempString
      • numberOfCharsReadSoFar

        private int numberOfCharsReadSoFar
      • bufferedReader

        private java.io.BufferedReader bufferedReader
      • 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
      • 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 java.lang.String[] columnTypes
      • fieldSeparator

        protected char[] fieldSeparator
      • fieldSeparatorLength

        protected int fieldSeparatorLength
      • recordSeparator

        protected char[] recordSeparator
      • recordSeparatorLength

        protected int recordSeparatorLength
      • nullString

        protected java.lang.String nullString
      • columnDefinition

        protected java.lang.String columnDefinition
      • format

        protected java.lang.String format
      • dataCodeset

        protected java.lang.String dataCodeset
      • fieldStartDelimiter

        protected char[] fieldStartDelimiter
      • fieldStartDelimiterLength

        protected int fieldStartDelimiterLength
      • fieldStopDelimiter

        protected char[] fieldStopDelimiter
      • fieldStopDelimiterLength

        protected int fieldStopDelimiterLength
      • hasDelimiterAtEnd

        protected boolean hasDelimiterAtEnd
      • lobFileName

        private java.lang.String lobFileName
      • lobOffset

        private long lobOffset
      • lobLength

        private int lobLength
      • haveSep

        private boolean haveSep
    • Constructor Detail

      • ImportReadData

        ImportReadData​(java.lang.String inputFileName,
                       ControlInfo controlFileReader,
                       short skipLines)
                throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • loadPropertiesInfo

        private void loadPropertiesInfo()
                                 throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getNumberOfColumns

        int getNumberOfColumns()
      • ignoreFirstRow

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

        protected void ignoreHeaderLines()
                                  throws java.lang.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:
        java.lang.Exception - if there is an error
      • loadColumnTypes

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

        private void openFile()
                       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<java.lang.Object>
        Throws:
        java.lang.Exception
      • realOpenFile

        private void realOpenFile()
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • loadMetaData

        private void loadMetaData()
                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • closeStream

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

        int findNumberOfColumnsInARow()
                               throws java.lang.Exception
        Throws:
        java.lang.Exception
      • checkForWhiteSpaceInFront

        private void checkForWhiteSpaceInFront()
      • checkForWhiteSpaceInBack

        private void checkForWhiteSpaceInBack()
      • readTokensUntilEndOfRecord

        boolean readTokensUntilEndOfRecord()
                                    throws java.lang.Exception
        Throws:
        java.lang.Exception
      • lookForPassedSeparator

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

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

        private boolean skipDoubleDelimiters​(char[] characterDelimiter)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • omitLineFeed

        private void omitLineFeed()
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • getCurrentRowNumber

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

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

        private boolean readNextFixedRow​(java.lang.String[] returnStringArray)
                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • readNextDelimitedRow

        private boolean readNextDelimitedRow​(java.lang.String[] returnStringArray)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • isFieldSep

        private boolean isFieldSep​(char[] chrArray)
      • readNextToken

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

        java.lang.String getClobColumnFromExtFileAsString​(java.lang.String lobLocationStr,
                                                          int colIndex)
                                                   throws java.sql.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:
        java.sql.SQLException - on any errors.
      • getClobColumnFromExtFile

        java.sql.Clob getClobColumnFromExtFile​(java.lang.String lobLocationStr,
                                               int colIndex)
                                        throws java.sql.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:
        java.sql.SQLException - on any errors.
      • getBlobColumnFromExtFile

        java.sql.Blob getBlobColumnFromExtFile​(java.lang.String lobLocationStr,
                                               int colIndex)
                                        throws java.sql.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:
        java.sql.SQLException - on any errors.
      • initExternalLobFile

        private void initExternalLobFile​(java.lang.String lobLocationStr,
                                         int colIndex)
                                  throws java.sql.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:
        java.sql.SQLException - on any errors.