Spring for Apache Hadoop

org.springframework.data.hadoop.store.input
Class AbstractDataStreamReader.ReaderHelper<T,V>

java.lang.Object
  extended by org.springframework.data.hadoop.store.input.AbstractDataStreamReader.ReaderHelper<T,V>
Type Parameters:
T - the type of reader
V - the type of data returned by reader
Enclosing class:
AbstractDataStreamReader

protected abstract static class AbstractDataStreamReader.ReaderHelper<T,V>
extends java.lang.Object

Reader helper hiding complexity of working with input streams.


Constructor Summary
protected AbstractDataStreamReader.ReaderHelper(StreamsHolder<java.io.InputStream> streamsHolder, InputContext inputContext, Split split, CodecInfo codec)
          Instantiates a new reader helper.
 
Method Summary
protected abstract  T createReader(java.io.InputStream inputStream)
          Creates the reader.
protected abstract  V doRead(T delegate)
          Do read.
protected  InputContext getContext()
          Gets the wrapped InputContext.
protected  StreamsHolder<java.io.InputStream> getHolder()
          Gets the StreamsHolder for wrapped input stream.
protected  T getReader()
          Gets the reader created by createReader(InputStream).
protected  void init()
          Inits the reader helper.
protected  void processReadCount(int readSize)
          Processing a count of bytes read from a stream.
protected  V read()
          Reads a data by delegating to a reader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDataStreamReader.ReaderHelper

protected AbstractDataStreamReader.ReaderHelper(StreamsHolder<java.io.InputStream> streamsHolder,
                                                InputContext inputContext,
                                                Split split,
                                                CodecInfo codec)
Instantiates a new reader helper.

Parameters:
streamsHolder - the streams holder
inputContext - the input context
split - the input split
codec - the compression codec info
Method Detail

createReader

protected abstract T createReader(java.io.InputStream inputStream)
                           throws java.io.IOException
Creates the reader.

Parameters:
inputStream - the input stream
Returns:
the reader
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

doRead

protected abstract V doRead(T delegate)
                     throws java.io.IOException
Do read.

Parameters:
delegate - the delegate reader
Returns:
the data read by a reader
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

init

protected void init()
             throws java.io.IOException
Inits the reader helper. This method must be called by an implementor.

Throws:
java.io.IOException - Signals that an I/O exception has occurred.

processReadCount

protected void processReadCount(int readSize)
                         throws java.io.IOException
Processing a count of bytes read from a stream. Internally we're may use Seekable depending if it has been set.

Parameters:
readSize - the read size
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

read

protected V read()
          throws java.io.IOException
Reads a data by delegating to a reader.

Returns:
the data read by a reader
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

getReader

protected T getReader()
Gets the reader created by createReader(InputStream).

Returns:
the reader

getHolder

protected StreamsHolder<java.io.InputStream> getHolder()
Gets the StreamsHolder for wrapped input stream.

Returns:
the streams holder

getContext

protected InputContext getContext()
Gets the wrapped InputContext.

Returns:
the input context

Spring for Apache Hadoop