Package adams.data.io.input
Class LineArrayTextReader
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,Serializable
public class LineArrayTextReader extends AbstractTextReaderWithEncoding<String[]>
Reads the text in as array of strings (each line is an array element).
For large files, the data can be 'chunked' (ie outputting it in blocks).
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-encoding <adams.core.base.BaseCharset> (property: encoding) The type of encoding to use when reading the file, use empty string for default. default: Default
-chunk-size <int> (property: chunkSize) The maximum number of lines per chunk; using -1 will read put all data into a single array. default: -1 minimum: -1
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intm_ChunkSizethe chunk size to use.protected Scannerm_Scannerthe scanner in use.-
Fields inherited from class adams.data.io.input.AbstractTextReaderWithEncoding
m_Encoding
-
Fields inherited from class adams.data.io.input.AbstractTextReader
m_Stream
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description LineArrayTextReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringchunkSizeTipText()Returns the tip text for this property.voiddefineOptions()Adds options to the internal list of options.String[]doNext()Returns the next lot of data.Classgenerates()Returns the class of the data that it returns.intgetChunkSize()Returns the current chunk size.StringglobalInfo()Returns a string describing the object.voidinitialize(InputStream stream)Initializes the input stream to read the content from.voidsetChunkSize(int value)Sets the maximum chunk size.-
Methods inherited from class adams.data.io.input.AbstractTextReaderWithEncoding
encodingTipText, getEncoding, getQuickInfo, setEncoding
-
Methods inherited from class adams.data.io.input.AbstractTextReader
hasNext, next, reset
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_ChunkSize
protected int m_ChunkSize
the chunk size to use.
-
m_Scanner
protected transient Scanner m_Scanner
the scanner in use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractTextReaderWithEncoding<String[]>
-
setChunkSize
public void setChunkSize(int value)
Sets the maximum chunk size.- Parameters:
value- the size of the chunks, < 1 denotes infinity
-
getChunkSize
public int getChunkSize()
Returns the current chunk size.- Returns:
- the size of the chunks, < 1 denotes infinity
-
chunkSizeTipText
public String chunkSizeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
generates
public Class generates()
Returns the class of the data that it returns.- Specified by:
generatesin classAbstractTextReader<String[]>- Returns:
- the generated data type
-
initialize
public void initialize(InputStream stream)
Initializes the input stream to read the content from.- Overrides:
initializein classAbstractTextReader<String[]>- Parameters:
stream- the input stream to use
-
doNext
public String[] doNext()
Returns the next lot of data.- Specified by:
doNextin classAbstractTextReader<String[]>- Returns:
- the next amount of data, null if failed to read
-
-