Package org.apache.derby.impl.load
Class ImportReadData
java.lang.Object
org.apache.derby.impl.load.ImportReadData
- All Implemented Interfaces:
PrivilegedExceptionAction<Object>
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
private BufferedReader
protected String
protected String[]
private int[]
protected ControlInfo
private char[]
private int
protected String
(package private) static final int
protected char[]
private char
protected int
private boolean
protected char[]
(package private) int
protected int
protected char[]
(package private) int
protected int
protected String
private int
(package private) boolean
(package private) boolean
private boolean
protected boolean
private boolean
private String
(package private) int
private ImportLobFile[]
private String
private int
private long
protected String
private int
protected int
(package private) int
(package private) int
protected char[]
private char
protected int
private boolean
private int
private short
private static final int
(package private) int
(package private) boolean
private char[]
(package private) int
-
Constructor Summary
ConstructorsConstructorDescriptionImportReadData
(String inputFileName, ControlInfo controlFileReader, short skipLines) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private void
(package private) void
close the input data file(package private) int
(package private) Blob
getBlobColumnFromExtFile
(String lobLocationStr, int colIndex) Returns a blob columnn data stored at the specified location as a java.sql.Blob object.(package private) Clob
getClobColumnFromExtFile
(String lobLocationStr, int colIndex) Returns a clob columnn data stored at the specified location as a java.sql.Clob object.(package private) String
getClobColumnFromExtFileAsString
(String lobLocationStr, int colIndex) Returns a clob columnn data stored at the specified location.(package private) int
returns the number of the current row(package private) int
protected void
if columndefinition is true, ignore first row.protected void
if skipHeaderLines is greater than 0, ignore skipHeaderLines number of lines.private void
initExternalLobFile
(String lobLocationStr, int colIndex) 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.private boolean
isFieldSep
(char[] chrArray) protected void
load the column types from the meta data line to be analyzed later in the constructor of the ImportResultSetMetaData.private void
private void
private int
lookForPassedSeparator
(char[] delimiter, int delimiterIndex, int delimiterLength, int nextChar, boolean lookForRecordSeperator) private void
private void
openFile()
private boolean
readNextDelimitedRow
(String[] returnStringArray) private boolean
readNextFixedRow
(String[] returnStringArray) (package private) boolean
readNextRow
(String[] returnStringArray) the way we read the next row from input file depends on it's format(package private) boolean
readNextToken
(char[] delimiter, int delimiterIndex, int delimiterLength, boolean isRecordSeperator) (package private) boolean
private void
private int
reCheckRestOfTheCharacters
(int startFrom, char[] delimiter, int delimiterLength) final Object
run()
private boolean
skipDoubleDelimiters
(char[] characterDelimiter)
-
Field Details
-
inputFileName
-
skipLines
private short skipLines -
columnWidths
private int[] columnWidths -
rowWidth
private int rowWidth -
tempString
private char[] tempString -
numberOfCharsReadSoFar
private int numberOfCharsReadSoFar -
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
-
numberOfColumns
protected int numberOfColumns -
columnTypes
-
fieldSeparator
protected char[] fieldSeparator -
fieldSeparatorLength
protected int fieldSeparatorLength -
recordSeparator
protected char[] recordSeparator -
recordSeparatorLength
protected int recordSeparatorLength -
nullString
-
columnDefinition
-
format
-
dataCodeset
-
fieldStartDelimiter
protected char[] fieldStartDelimiter -
fieldStartDelimiterLength
protected int fieldStartDelimiterLength -
fieldStopDelimiter
protected char[] fieldStopDelimiter -
fieldStopDelimiterLength
protected int fieldStopDelimiterLength -
hasDelimiterAtEnd
protected boolean hasDelimiterAtEnd -
lobFileHandles
-
lobFileName
-
lobOffset
private long lobOffset -
lobLength
private int lobLength -
haveSep
private boolean haveSep
-
-
Constructor Details
-
ImportReadData
ImportReadData(String inputFileName, ControlInfo controlFileReader, short skipLines) throws Exception - Throws:
Exception
-
-
Method Details
-
loadPropertiesInfo
- Throws:
Exception
-
getNumberOfColumns
int getNumberOfColumns() -
ignoreFirstRow
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
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
load the column types from the meta data line to be analyzed later in the constructor of the ImportResultSetMetaData.- Throws:
Exception
-
openFile
- Throws:
Exception
-
run
- Specified by:
run
in interfacePrivilegedExceptionAction<Object>
- Throws:
Exception
-
realOpenFile
- Throws:
Exception
-
loadMetaData
- Throws:
Exception
-
closeStream
close the input data file- Throws:
Exception
- if there is an error
-
findNumberOfColumnsInARow
- Throws:
Exception
-
checkForWhiteSpaceInFront
private void checkForWhiteSpaceInFront() -
checkForWhiteSpaceInBack
private void checkForWhiteSpaceInBack() -
readTokensUntilEndOfRecord
- 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
- Throws:
IOException
-
omitLineFeed
- Throws:
IOException
-
getCurrentRowNumber
int getCurrentRowNumber()returns the number of the current row -
readNextRow
the way we read the next row from input file depends on it's format- Throws:
Exception
- if there is an error
-
readNextFixedRow
- Throws:
Exception
-
readNextDelimitedRow
- Throws:
Exception
-
isFieldSep
private boolean isFieldSep(char[] chrArray) -
readNextToken
boolean readNextToken(char[] delimiter, int delimiterIndex, int delimiterLength, boolean isRecordSeperator) throws Exception - Throws:
Exception
-
getClobColumnFromExtFileAsString
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
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
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
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.
-