T
- the data typepublic abstract class AbstractCsvStreamFormat<T> extends ConfigurableBinaryStreamFormat<T>
Constructor and Description |
---|
AbstractCsvStreamFormat() |
Modifier and Type | Method and Description |
---|---|
ModelInput<T> |
createInput(Class<? extends T> dataType,
String path,
InputStream stream,
long offset,
long fragmentSize)
Creates a new
ModelInput for the specified properties. |
ModelOutput<T> |
createOutput(Class<? extends T> dataType,
String path,
OutputStream stream)
Creates a new
ModelOutput for the specified properties. |
protected abstract void |
emit(CsvEmitter output,
T model,
StringOption path)
Emits the next record body from the data object into the target output.
|
protected Class<? extends org.apache.hadoop.io.compress.CompressionCodec> |
getCompressionCodecClass()
Returns the compression codec class.
|
protected abstract CsvConfiguration |
getConfiguration(boolean head)
Returns the CSV format configuration.
|
protected InputSplitter |
getInputSplitter()
Returns the input splitter of this format.
|
long |
getMinimumFragmentSize()
Returns the lower limit of fragment size (in bytes).
|
long |
getPreferredFragmentSize()
Returns the preferred fragment size (in bytes).
|
protected abstract void |
parse(CsvParser input,
T model,
StringOption path)
Parses next record body and fill the contents into the target model.
|
getConf, setConf
createInput
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSupportedType
protected abstract CsvConfiguration getConfiguration(boolean head)
head
- true
to returns a configuration for the head of file, otherwise false
protected abstract void parse(CsvParser input, T model, StringOption path) throws IOException
input
- the current inputmodel
- the target data objectpath
- the current input pathIOException
- if I/O error was occurredprotected abstract void emit(CsvEmitter output, T model, StringOption path) throws IOException
output
- the current outputmodel
- the data objectpath
- the current output pathIOException
- if I/O error was occurredprotected InputSplitter getInputSplitter()
null
is input split is disabledprotected Class<? extends org.apache.hadoop.io.compress.CompressionCodec> getCompressionCodecClass()
null
if compression is disabledpublic final long getPreferredFragmentSize()
FragmentableDataFormat
-1
as infinitepublic final long getMinimumFragmentSize()
FragmentableDataFormat
-1
as infinite (never split into fragments)public ModelInput<T> createInput(Class<? extends T> dataType, String path, InputStream stream, long offset, long fragmentSize) throws IOException, InterruptedException
BinaryStreamFormat
ModelInput
for the specified properties.createInput
in class BinaryStreamFormat<T>
dataType
- the target data typepath
- the path about the target stream (for label)stream
- the target streamoffset
- starting stream offsetfragmentSize
- suggested fragment bytes count, or -1
as infiniteIOException
- if failed to create readerInterruptedException
- if interruptedpublic ModelOutput<T> createOutput(Class<? extends T> dataType, String path, OutputStream stream) throws IOException, InterruptedException
BinaryStreamFormat
ModelOutput
for the specified properties.createOutput
in class BinaryStreamFormat<T>
dataType
- the target data typepath
- the path about the target stream (for label)stream
- the target streamIOException
- if failed to create writerInterruptedException
- if interruptedCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.