Spring for Apache Hadoop

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

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

public class DelimitedTextFileReader
extends java.lang.Object
implements DataStoreReader<java.util.List<java.lang.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(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec)
          Instantiates a new delimited text file reader.
DelimitedTextFileReader(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec, byte[] fieldDelimiter)
          Instantiates a new delimited text file reader.
DelimitedTextFileReader(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec, Split inputSplit, byte[] fieldDelimiter, byte[] textDelimiter)
          Instantiates a new delimited text file reader.
 
Method Summary
 void close()
           
 java.util.List<java.lang.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(org.apache.hadoop.conf.Configuration configuration,
                               org.apache.hadoop.fs.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(org.apache.hadoop.conf.Configuration configuration,
                               org.apache.hadoop.fs.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(org.apache.hadoop.conf.Configuration configuration,
                               org.apache.hadoop.fs.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 java.util.List<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.util.List<java.lang.String>>
Returns:
the entity or null
Throws:
java.io.IOException - if an I/O error occurs

close

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

Spring for Apache Hadoop