Spring for Apache Hadoop

org.springframework.data.hadoop.store.input
Class TextFileReader

java.lang.Object
  extended by org.springframework.data.hadoop.store.support.LifecycleObjectSupport
      extended by org.springframework.data.hadoop.store.support.StoreObjectSupport
          extended by org.springframework.data.hadoop.store.support.InputStoreObjectSupport
              extended by org.springframework.data.hadoop.store.input.AbstractDataStreamReader
                  extended by org.springframework.data.hadoop.store.input.TextFileReader
All Implemented Interfaces:
java.io.Closeable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, DataReader<java.lang.String>, DataStoreReader<java.lang.String>

public class TextFileReader
extends AbstractDataStreamReader
implements DataStoreReader<java.lang.String>

A TextFileReader is a DataStoreReader implementation able to read Strings from a raw hdfs files.

Author:
Janne Valkealahti

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.data.hadoop.store.input.AbstractDataStreamReader
AbstractDataStreamReader.ReaderHelper<T,V>
 
Constructor Summary
TextFileReader(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec)
          Instantiates a new text file reader.
TextFileReader(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec, Split split)
          Instantiates a new text file reader.
TextFileReader(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec, Split split, byte[] delimiter)
          Instantiates a new text file reader.
 
Method Summary
 void close()
           
 java.lang.String read()
          Read next entity from a reader.
 
Methods inherited from class org.springframework.data.hadoop.store.input.AbstractDataStreamReader
getInput
 
Methods inherited from class org.springframework.data.hadoop.store.support.InputStoreObjectSupport
getInputContext, getSplit
 
Methods inherited from class org.springframework.data.hadoop.store.support.StoreObjectSupport
doStart, doStop, getCodec, getConfiguration, getPath, handleIdleTimeout, isCompressed, onInit, resetIdleTimeout, setIdleTimeout
 
Methods inherited from class org.springframework.data.hadoop.store.support.LifecycleObjectSupport
afterPropertiesSet, getBeanFactory, getPhase, getStoreEventPublisher, getTaskExecutor, getTaskScheduler, isAutoStartup, isRunning, setAutoStartup, setBeanFactory, setPhase, setStoreEventPublisher, setTaskExecutor, setTaskScheduler, start, stop, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextFileReader

public TextFileReader(org.apache.hadoop.conf.Configuration configuration,
                      org.apache.hadoop.fs.Path basePath,
                      CodecInfo codec)
Instantiates a new text file reader.

Parameters:
configuration - the hadoop configuration
basePath - the hdfs path
codec - the compression codec info

TextFileReader

public TextFileReader(org.apache.hadoop.conf.Configuration configuration,
                      org.apache.hadoop.fs.Path basePath,
                      CodecInfo codec,
                      Split split)
Instantiates a new text file reader.

Parameters:
configuration - the configuration
basePath - the base path
codec - the codec
split - the input split

TextFileReader

public TextFileReader(org.apache.hadoop.conf.Configuration configuration,
                      org.apache.hadoop.fs.Path basePath,
                      CodecInfo codec,
                      Split split,
                      byte[] delimiter)
Instantiates a new text file reader.

Parameters:
configuration - the configuration
basePath - the base path
codec - the codec
split - the input split
delimiter - the delimiter
Method Detail

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException

read

public java.lang.String read()
                      throws java.io.IOException
Description copied from interface: DataReader
Read next entity from a reader.

Specified by:
read in interface DataReader<java.lang.String>
Returns:
the entity or null
Throws:
java.io.IOException - if an I/O error occurs

Spring for Apache Hadoop