T
- the data typepublic abstract class AbstractLineStreamFormat<T> extends ConfigurableBinaryStreamFormat<T>
Constructor and Description |
---|
AbstractLineStreamFormat() |
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(LineOutput output,
T model,
StringOption path)
Emits the next line 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 LineConfiguration |
getConfiguration()
Returns the line based text 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 boolean |
parse(LineInput input,
T model,
StringOption path)
Parses next line and fill into the target data object.
|
getConf, setConf
createInput
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSupportedType
protected abstract LineConfiguration getConfiguration()
protected abstract boolean parse(LineInput input, T model, StringOption path) throws IOException
input
- the current inputmodel
- the target data objectpath
- the current input pathtrue
if it was succeeded, otherwise false
IOException
- if I/O error was occurredprotected abstract void emit(LineOutput 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.