T
- the data model typepublic class TemporaryFileInput<T extends org.apache.hadoop.io.Writable> extends Object implements ModelInput<T>
Constructor and Description |
---|
TemporaryFileInput(InputStream input,
int blocks)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
getCurrentBlock()
Returns the current block number (
0.. ). |
String |
getDataTypeName()
Returns the target data type name.
|
int |
getPositionInBlock()
Returns the byte position in current block.
|
boolean |
readTo(T model)
Reads contents and write them into the target data model object.
|
public TemporaryFileInput(InputStream input, int blocks)
input
- the input stream (must be on the head of a block)blocks
- the number of blocks to read, or 0
to read all pages in the streampublic String getDataTypeName() throws IOException
IOException
- if failed to extract the data type namepublic int getCurrentBlock()
0..
).public int getPositionInBlock()
public boolean readTo(T model) throws IOException
ModelInput
readTo
in interface ModelInput<T extends org.apache.hadoop.io.Writable>
model
- the target data model objecttrue
if the next data was successfully read, or false
if there is no any moreIOException
- if error occurred while reading the next datapublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.