T - type of values returned by this readerpublic abstract class ForwardingInputReader<T> extends InputReader<T>
InputReader delegates to another implementation.| Constructor and Description |
|---|
ForwardingInputReader() |
| Modifier and Type | Method and Description |
|---|---|
void |
beginShard()
Performs setup at the beginning of the shard.
|
void |
beginSlice()
Prepares the
InputReader for reading, after possibly having gone
through serialization and deserialization. |
void |
endShard()
Called after endSlice if there will not be any subsequent calls to beginSlice or next.
|
void |
endSlice()
Prepares the
InputReader for serialization. |
long |
estimateMemoryRequirement()
Returns the estimated memory that will be used by this reader in bytes.
|
ShardContext |
getContext()
Returns the current context, or null if none.
|
protected abstract InputReader<T> |
getDelegate() |
Double |
getProgress()
Returns the relative progress reading this input as a number from 0 to 1.
|
T |
next()
Returns the next input value, or throws
NoSuchElementException
when there is no more input data. |
void |
setContext(ShardContext context)
Used internally to sets the context to be used for the processing that follows.
|
close, openprotected abstract InputReader<T> getDelegate()
public T next() throws IOException, NoSuchElementException
InputReaderNoSuchElementException
when there is no more input data. This is done rather than providing a
hasNext() function, to allow the implementation to deal with streams and
remain serializable, even if the item being read is not.next in class InputReader<T>IOExceptionNoSuchElementExceptionpublic Double getProgress()
InputReadergetProgress in class InputReader<T>public void beginSlice()
throws IOException
InputReaderInputReader for reading, after possibly having gone
through serialization and deserialization.beginSlice in class InputReader<T>IOException - in the event of failurepublic void endSlice()
throws IOException
InputReaderInputReader for serialization.endSlice in class InputReader<T>IOException - in the event of failurepublic void beginShard()
throws IOException
InputReaderInputReader.beginSlice(). It will not be invoked again unless the shard restarts. When a shard is
restarted, this method is invoked and the input should be read from the beginning.beginShard in class InputReader<T>IOException - in the event of failurepublic void endShard()
throws IOException
InputReaderendShard in class InputReader<T>IOException - in the event of failurepublic long estimateMemoryRequirement()
InputReaderestimateMemoryRequirement in class InputReader<T>public void setContext(ShardContext context)
InputReadersetContext in class InputReader<T>public ShardContext getContext()
InputReadergetContext in class InputReader<T>Copyright © 2015 Google. All rights reserved.