K
- the type of raw sequence file keyV
- the type of raw sequence file valueT
- the type of target data modelpublic abstract class SequenceFileFormat<K,V,T> extends HadoopFileFormat<T>
InputStream
/ OutputStream
.
This implementation class must have a public constructor without any parameters.Constructor and Description |
---|
SequenceFileFormat() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
copyFromModel(T model,
K key,
V value)
Copy the data model into the key and value.
|
protected abstract void |
copyToModel(K key,
V value,
T model)
Copy key and value into the target data model.
|
ModelInput<T> |
createInput(Class<? extends T> dataType,
org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.Path path,
long offset,
long fragmentSize,
Counter counter)
Creates a new
ModelInput for the specified properties. |
protected abstract K |
createKeyObject()
Returns a key object.
|
ModelOutput<T> |
createOutput(Class<? extends T> dataType,
org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.Path path,
Counter counter)
Creates a new
ModelOutput for the specified properties. |
protected abstract V |
createValueObject()
Returns a value object.
|
org.apache.hadoop.io.compress.CompressionCodec |
getCompressionCodec(org.apache.hadoop.fs.Path path)
Returns a compression codec for output sequence files.
|
long |
getMinimumFragmentSize()
Returns the lower limit of fragment size (in bytes).
|
createInput
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPreferredFragmentSize
getSupportedType
public long getMinimumFragmentSize() throws IOException, InterruptedException
FragmentableDataFormat
-1
as infinite (never split into fragments)IOException
- if failed to compute bytes countInterruptedException
- if interruptedprotected abstract K createKeyObject()
protected abstract V createValueObject()
protected abstract void copyToModel(K key, V value, T model) throws IOException
key
- the source key objectvalue
- the source value objectmodel
- the target data modelIOException
- if failed to copyprotected abstract void copyFromModel(T model, K key, V value) throws IOException
model
- the source data modelkey
- the target key objectvalue
- the target value objectIOException
- if failed to copypublic ModelInput<T> createInput(Class<? extends T> dataType, org.apache.hadoop.fs.FileSystem fileSystem, org.apache.hadoop.fs.Path path, long offset, long fragmentSize, Counter counter) throws IOException, InterruptedException
HadoopFileFormat
ModelInput
for the specified properties.createInput
in class HadoopFileFormat<T>
dataType
- the target data typefileSystem
- the file system to open the target pathpath
- the path to the target fileoffset
- starting stream offsetfragmentSize
- suggested fragment bytes count, or -1
as infinitecounter
- the current counterIOException
- if failed to create readerInterruptedException
- if interruptedpublic ModelOutput<T> createOutput(Class<? extends T> dataType, org.apache.hadoop.fs.FileSystem fileSystem, org.apache.hadoop.fs.Path path, Counter counter) throws IOException, InterruptedException
HadoopFileFormat
ModelOutput
for the specified properties.createOutput
in class HadoopFileFormat<T>
dataType
- the target data typefileSystem
- the file system to open the target pathpath
- the path to the target filecounter
- the current counterIOException
- if failed to create writerInterruptedException
- if interruptedpublic org.apache.hadoop.io.compress.CompressionCodec getCompressionCodec(org.apache.hadoop.fs.Path path) throws IOException, InterruptedException
CompressionCodec
object.path
- target pathnull
if output will not be compressedIOException
- if failed to create a compression codecInterruptedException
- if interruptedCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.