private static class ImportWorker.DataFileReader extends FileStream
FileStream.BOM
Stream.PrintMode
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
dateFormat
The date format as it was set when the table was dumped.
|
private char |
decimalSeparator
The decimal separator character for decimal numbers.
|
private java.lang.String |
encoding
The code-page encoding for this file or
null if not present. |
private char |
groupSeparator
The group separator character for numbers.
|
private java.lang.String |
ldbname
The name of the table that was exported to this file.
|
private static int |
MAX_PAYLOADSIZE_SIZE
The standard size of the payload.
|
private static int |
MAX_PSC_FOOTER_SIZE
The maximum size of the footer.
|
private static java.lang.String |
PSC_HEADER_MAGIC
The PSC header magic line.
|
private java.util.Map<java.lang.String,java.lang.String> |
pscHeader
The map with read key/values pairs form PSC footer.
|
private long |
recordCount
The number of records that were saved to this file.
|
private java.lang.String |
timestamp
The timestamp when this file was created.
|
private int |
windowingYear
The windowing year for date as it was set when the table was dumped.
|
binaryBuffer, decoder, file, fileName, MAPPED_BUF_SZ
_convert, binary, convert, convertCached, CR, DELIM, doneIn, doneOut, EOF, increment, internalCp, LF, mapEntryProtermcap, MODE_EXPORT, MODE_PUT_CONTROL, MODE_PUT_NORMAL, MODE_PUT_UNFORMATTED, NEW_LINES, NEWLINE, NEWLINE_LEN, noMap, PAGED_DEFAULT, PIPE_BROKEN_MESSAGE, SET_PAGED_DEFAULT, sourceCharset, sourceCp, streamCp, targetCharset, targetCp, UNKNOWN_VALUE
Constructor and Description |
---|
DataFileReader(java.lang.String filePath)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getMetadata(java.lang.String key)
Return the metadata value associated with this key.
|
long |
getRecordCount()
Obtain the expected record count in this file.
|
private void |
initialize()
Initializes the import for this table based on the values read from the PSC footer values of this
stream previously read in metadata map, defaulting to values read from the configuration file.
|
private boolean |
locateFooterHeuristic(int bpc)
Attempts to locate the PSC header using heuristic methods (incrementally scan for PSC magic bytes).
|
private java.lang.String |
locateFooterStrict(int bpc)
Attempt to locate the footer using the strict file format.
|
private int |
readPscFooter(java.lang.String filename,
int bytesPerChar)
Reads the PSC footer, storing the key/values pairs in private map pscHeader.
|
protected boolean |
skipLoneHyphenInput()
Don't skip a lone hyphen read from an export file.
|
assign, available, close, closeIn, closeOut, decode, decode, flush, flushData, getLen, getPos, initBinaryBuffer, isFileResource, isIn, isOut, map, peekCh, readBOM, readByte, readBytes, readCh, readLn, setConvertSource, setInvalidBytesMapping, setLen, setPos, unmap, write, write, write, writeByte, writeCh
advancePage, afterWrite, assignDatum, cleanup, deleted, deregisterFooter, deregisterHeader, endOutput, endOutput, export, finished, flushControlled, forcePageBreak, forcePageBreak, generateStringFormat, getAvailableLines, getControl, getConvert, getDelimiter, getDisplayMode, getEcho, getEffectivePageSize, getLength, getName, getNextLineNum, getPageNum, getPageSize, getPendingRowCount, getPosition, getPulseOnClose, getUnformatted, hasPageHeadersFooters, indexOfNewLine, isContiguous, isFreshPage, isKeepMessages, isNewLine, isSilent, isSuppressFormFeed, isTerm, isUnbuffered, isUnnamed, isValid, iterate, needsHeadersOutput, processFooters, processHeaders, processHeadersInt, processHeadersUncond, protectReads, protectWrites, pulseOutput, put, putControl, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putField, putLineEnd, putLineEnd, putNull, putNull, putSpace, putSpace, putUnformatted, putWorker, rawNextLineNum, rawPageSize, readBlock, readBlockRemote, readChar, readChar, readChunk, readField, readField, readField, readField, readFieldWorker, readLine, readLine, readLine, readLine, readLineCleanup, registerAdvanceListener, registerCloseListener, registerFlushListener, registerFooter, registerHeader, registerPageBreakListener, resetCurrentLine, retry, setAppend, setBinary, setContiguous, setControl, setConvert, setConvertSource, setConvertTarget, setConvertTarget, setDelimiter, setDelimiter, setEcho, setFont, setFont, setKeepMessages, setLandscape, setMap, setName, setNoMap, setPageSize, setPageSize, setPageSize, setPendingRowCount, setPortrait, setPosition, setPosition, setPulseOnClose, setUnbuffered, setUnformatted, setUnnamed, skipField, startOutput, writeBlock, writeControlled, writeControlledSpecial, writeField, writeField, writeField, writeField, writeField
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
entry, initFailure, weight
private static final java.lang.String PSC_HEADER_MAGIC
private static final int MAX_PAYLOADSIZE_SIZE
private static final int MAX_PSC_FOOTER_SIZE
private java.util.Map<java.lang.String,java.lang.String> pscHeader
private java.lang.String encoding
null
if not present.private long recordCount
private java.lang.String ldbname
private java.lang.String timestamp
private char groupSeparator
private char decimalSeparator
private int windowingYear
private java.lang.String dateFormat
public DataFileReader(java.lang.String filePath) throws ErrorConditionException
filePath
- File to be read.ErrorConditionException
- if there is an error finding or reading the file.public java.lang.String getMetadata(java.lang.String key)
key
- The key for the entry to be queried.null
.public long getRecordCount()
protected boolean skipLoneHyphenInput()
skipLoneHyphenInput
in class Stream
false
.private int readPscFooter(java.lang.String filename, int bytesPerChar)
filename
- File to be read. Used only to report errors.bytesPerChar
- Standard bytes per character in the current text encoding.private java.lang.String locateFooterStrict(int bpc)
If the PSC footer is located the read file pointer is positioned right before the first PSC key/value pair. Otherwise its location is undefined.
bpc
- The number of bytes per character in the current character encoding.null
. Otherwise a non-null String
is returned describing the encountered
error.private boolean locateFooterHeuristic(int bpc)
If the PSC footer is located the read file pointer is positioned right before the first PSC key/value pair. Otherwise its location is undefined.
bpc
- The number of bytes per character in the current character encoding.true
if the PSC footer was successfully found and false
otherwise.private void initialize()