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

java.lang.Object
  extended by org.springframework.data.hadoop.store.input.DelimitedTextFileReader
All Implemented Interfaces:
Closeable, DataReader<List<String>>, DataStoreReader<List<String>>

public class DelimitedTextFileReader
extends Object
implements DataStoreReader<List<String>>

A DelimitedTextFileReader is a DataStoreReader implementation able to read Strings from a raw hdfs files as delimited fields.

Author:
Janne Valkealahti

Field Summary
static byte[] CSV
          CSV Mode
static byte[] TAB
          TAB Mode
 
Constructor Summary
DelimitedTextFileReader(Configuration configuration, Path basePath, CodecInfo codec)
          Instantiates a new delimited text file reader.
DelimitedTextFileReader(Configuration configuration, Path basePath, CodecInfo codec, byte[] fieldDelimiter)
          Instantiates a new delimited text file reader.
DelimitedTextFileReader(Configuration configuration, Path basePath, CodecInfo codec, Split inputSplit, byte[] fieldDelimiter, byte[] textDelimiter)
          Instantiates a new delimited text file reader.
 
Method Summary
 void close()
           
 List<String> read()
          Read next entity from a reader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CSV

public static final byte[] CSV
CSV Mode


TAB

public static final byte[] TAB
TAB Mode

Constructor Detail

DelimitedTextFileReader

public DelimitedTextFileReader(Configuration configuration,
                               Path basePath,
                               CodecInfo codec)
Instantiates a new delimited text file reader.

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

DelimitedTextFileReader

public DelimitedTextFileReader(Configuration configuration,
                               Path basePath,
                               CodecInfo codec,
                               byte[] fieldDelimiter)
Instantiates a new delimited text file reader.

Parameters:
configuration - the configuration
basePath - the base path
codec - the codec
fieldDelimiter - the field delimiter

DelimitedTextFileReader

public DelimitedTextFileReader(Configuration configuration,
                               Path basePath,
                               CodecInfo codec,
                               Split inputSplit,
                               byte[] fieldDelimiter,
                               byte[] textDelimiter)
Instantiates a new delimited text file reader.

Parameters:
configuration - the configuration
basePath - the base path
codec - the codec
fieldDelimiter - the field delimiter
textDelimiter - the text delimiter
Method Detail

read

public List<String> read()
                  throws IOException
Description copied from interface: DataReader
Read next entity from a reader.

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

close

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