Top Fields Constructors Methods
org.apache.derby.impl.load

pack-priv final Class ImportReadData

extends Object
Class Inheritance
Imports
java.io.BufferedReader, .FileNotFoundException, .InputStream, .InputStreamReader, .FileInputStream, .IOException, .File, java.net.MalformedURLException, .URISyntaxException, .URI, .URL, org.apache.derby.shared.common.sanity.SanityManager, java.sql.SQLException

Field Summary

Modifier and TypeField and Description
pack-priv static final int
private BufferedReader
protected String
protected String[]
private int[]
protected ControlInfo
private char[]
private int
protected String
pack-priv static final int
protected char[]
private char
protected int
private boolean
protected char[]
pack-priv int
protected int
protected char[]
pack-priv int
protected int
protected String
private int
pack-priv boolean
pack-priv boolean
private boolean
protected boolean
private boolean
private String
pack-priv int
private ImportLobFile[]
private String
private int
private long
protected String
private int
protected int
pack-priv int
pack-priv int
protected char[]
private char
protected int
private boolean
private int
private short
private static final int
pack-priv int
pack-priv boolean
private char[]
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv
ImportReadData(String inputFileName, ControlInfo controlFileReader, short skipLines)

Method Summary

Modifier and TypeMethod and Description
private void
private void
pack-priv void
closeStream()

close the input data file

pack-priv int
pack-priv Blob
getBlobColumnFromExtFile(String
location of the clob data.
lobLocationStr
,
int
number of the column. starts at 1.
colIndex
)

Returns a blob columnn data stored at the specified location as a java.sql.Blob object.

pack-priv Clob
getClobColumnFromExtFile(String
location of the clob data.
lobLocationStr
,
int
number of the column. starts at 1.
colIndex
)

Returns a clob columnn data stored at the specified location as a java.sql.Clob object.

pack-priv String
getClobColumnFromExtFileAsString(String
location of the clob data.
lobLocationStr
,
int
number of the column. starts at 1.
colIndex
)

Returns a clob columnn data stored at the specified location.

pack-priv int
getCurrentRowNumber()

returns the number of the current row

pack-priv int
protected void
ignoreFirstRow()

if columndefinition is true, ignore first row.

protected void
ignoreHeaderLines()

if skipHeaderLines is greater than 0, ignore skipHeaderLines number of lines.

private void
initExternalLobFile(String
location of the clob data.
lobLocationStr
,
int
number of the column. starts at 1.
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
loadColumnTypes()

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
private boolean
readNextDelimitedRow(String[] returnStringArray)

private boolean
readNextFixedRow(String[] returnStringArray)

pack-priv boolean
readNextRow(String[] returnStringArray)

the way we read the next row from input file depends on it's format

pack-priv boolean
readNextToken(char[] delimiter, int delimiterIndex, int delimiterLength, boolean isRecordSeperator)

pack-priv boolean
private void
private int
reCheckRestOfTheCharacters(int startFrom, char[] delimiter, int delimiterLength)

public final Object
run()

private boolean
skipDoubleDelimiters(char[] characterDelimiter)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ASCII_FIXED_FORMAT_CODEback to summary
pack-priv static final int ASCII_FIXED_FORMAT_CODE
bufferedReaderback to summary
private BufferedReader bufferedReader
columnDefinitionback to summary
protected String columnDefinition
columnTypesback to summary
protected String[] columnTypes
columnWidthsback to summary
private int[] columnWidths
controlFileReaderback to summary
protected ControlInfo controlFileReader
currentTokenback to summary
private char[] currentToken
currentTokenMaxSizeback to summary
private int currentTokenMaxSize
dataCodesetback to summary
protected String dataCodeset
DEFAULT_FORMAT_CODEback to summary
pack-priv static final int DEFAULT_FORMAT_CODE
fieldSeparatorback to summary
protected char[] fieldSeparator
fieldSeparatorChar0back to summary
private char fieldSeparatorChar0
fieldSeparatorLengthback to summary
protected int fieldSeparatorLength
fieldSepStartNotWhiteback to summary
private boolean fieldSepStartNotWhite
fieldStartDelimiterback to summary
protected char[] fieldStartDelimiter
fieldStartDelimiterIndexback to summary
pack-priv int fieldStartDelimiterIndex
fieldStartDelimiterLengthback to summary
protected int fieldStartDelimiterLength
fieldStopDelimiterback to summary
protected char[] fieldStopDelimiter
fieldStopDelimiterIndexback to summary
pack-priv int fieldStopDelimiterIndex
fieldStopDelimiterLengthback to summary
protected int fieldStopDelimiterLength
formatback to summary
protected String format
formatCodeback to summary
private int formatCode
foundStartAndStopDelimitersback to summary
pack-priv boolean foundStartAndStopDelimiters
foundStartDelimiterback to summary
pack-priv boolean foundStartDelimiter
hasColumnDefinitionback to summary
private boolean hasColumnDefinition
hasDelimiterAtEndback to summary
protected boolean hasDelimiterAtEnd
haveSepback to summary
private boolean haveSep
inputFileNameback to summary
private String inputFileName
lineNumberback to summary
pack-priv int lineNumber
lobFileHandlesback to summary
private ImportLobFile[] lobFileHandles
lobFileNameback to summary
private String lobFileName
lobLengthback to summary
private int lobLength
lobOffsetback to summary
private long lobOffset
nullStringback to summary
protected String nullString
numberOfCharsReadSoFarback to summary
private int numberOfCharsReadSoFar
numberOfColumnsback to summary
protected int numberOfColumns
positionOfNonWhiteSpaceCharInBackback to summary
pack-priv int positionOfNonWhiteSpaceCharInBack
positionOfNonWhiteSpaceCharInFrontback to summary
pack-priv int positionOfNonWhiteSpaceCharInFront
recordSeparatorback to summary
protected char[] recordSeparator
recordSeparatorChar0back to summary
private char recordSeparatorChar0
recordSeparatorLengthback to summary
protected int recordSeparatorLength
recordSepStartNotWhiteback to summary
private boolean recordSepStartNotWhite
rowWidthback to summary
private int rowWidth
skipLinesback to summary
private short skipLines
START_SIZEback to summary
private static final int START_SIZE
stopDelimiterPositionback to summary
pack-priv int stopDelimiterPosition
streamOpenForReadingback to summary
pack-priv boolean streamOpenForReading
tempStringback to summary
private char[] tempString
totalCharsSoFarback to summary
pack-priv int totalCharsSoFar

Constructor Detail

ImportReadDataback to summary
pack-priv ImportReadData(String inputFileName, ControlInfo controlFileReader, short skipLines) throws Exception

Method Detail

checkForWhiteSpaceInBackback to summary
private void checkForWhiteSpaceInBack()
checkForWhiteSpaceInFrontback to summary
private void checkForWhiteSpaceInFront()
closeStreamback to summary
pack-priv void closeStream() throws Exception

close the input data file

Exceptions
Exception:
if there is an error
findNumberOfColumnsInARowback to summary
pack-priv int findNumberOfColumnsInARow() throws Exception
getBlobColumnFromExtFileback to summary
pack-priv 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:String

location of the clob data.

colIndex:int

number of the column. starts at 1.

Exceptions
SQLException:
on any errors.
getClobColumnFromExtFileback to summary
pack-priv 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:String

location of the clob data.

colIndex:int

number of the column. starts at 1.

Exceptions
SQLException:
on any errors.
getClobColumnFromExtFileAsStringback to summary
pack-priv String getClobColumnFromExtFileAsString(String lobLocationStr, int colIndex) throws SQLException

Returns a clob columnn data stored at the specified location.

Parameters
lobLocationStr:String

location of the clob data.

colIndex:int

number of the column. starts at 1.

Exceptions
SQLException:
on any errors.
getCurrentRowNumberback to summary
pack-priv int getCurrentRowNumber()

returns the number of the current row

getNumberOfColumnsback to summary
pack-priv int getNumberOfColumns()
ignoreFirstRowback to summary
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

Exceptions
Exception:
if there is an error
ignoreHeaderLinesback to summary
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

Exceptions
Exception:
if there is an error
initExternalLobFileback to summary
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:String

location of the clob data.

colIndex:int

number of the column. starts at 1.

Exceptions
SQLException:
on any errors.
isFieldSepback to summary
private boolean isFieldSep(char[] chrArray)
loadColumnTypesback to summary
protected void loadColumnTypes() throws Exception

load the column types from the meta data line to be analyzed later in the constructor of the ImportResultSetMetaData.

loadMetaDataback to summary
private void loadMetaData() throws Exception
loadPropertiesInfoback to summary
private void loadPropertiesInfo() throws Exception
lookForPassedSeparatorback to summary
private int lookForPassedSeparator(char[] delimiter, int delimiterIndex, int delimiterLength, int nextChar, boolean lookForRecordSeperator) throws IOException
omitLineFeedback to summary
private void omitLineFeed() throws IOException
openFileback to summary
private void openFile() throws Exception
readNextDelimitedRowback to summary
private boolean readNextDelimitedRow(String[] returnStringArray) throws Exception
readNextFixedRowback to summary
private boolean readNextFixedRow(String[] returnStringArray) throws Exception
readNextRowback to summary
pack-priv boolean readNextRow(String[] returnStringArray) throws Exception

the way we read the next row from input file depends on it's format

Exceptions
Exception:
if there is an error
readNextTokenback to summary
pack-priv boolean readNextToken(char[] delimiter, int delimiterIndex, int delimiterLength, boolean isRecordSeperator) throws Exception
readTokensUntilEndOfRecordback to summary
pack-priv boolean readTokensUntilEndOfRecord() throws Exception
realOpenFileback to summary
private void realOpenFile() throws Exception
reCheckRestOfTheCharactersback to summary
private int reCheckRestOfTheCharacters(int startFrom, char[] delimiter, int delimiterLength)
runback to summary
public final Object run() throws Exception
skipDoubleDelimitersback to summary
private boolean skipDoubleDelimiters(char[] characterDelimiter) throws IOException