Spring for Apache Hadoop

org.springframework.data.hadoop.store.output
Class DelimitedTextFileWriter

java.lang.Object
  extended by org.springframework.data.hadoop.store.output.DelimitedTextFileWriter
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, DataStoreWriter<java.util.List<java.lang.String>>, DataWriter<java.util.List<java.lang.String>>

public class DelimitedTextFileWriter
extends java.lang.Object
implements DataStoreWriter<java.util.List<java.lang.String>>

A DelimitedTextFileWriter is a DataStoreWriter implementation able to write Strings into raw hdfs files as delimited fields.

Author:
Janne Valkealahti

Field Summary
static byte[] CSV
          CSV Mode
static byte[] TAB
          TAB Mode
 
Constructor Summary
DelimitedTextFileWriter(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec)
          Instantiates a new delimited text file writer.
DelimitedTextFileWriter(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec, byte[] fieldDelimiter)
          Instantiates a new delimited text file writer.
DelimitedTextFileWriter(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec, byte[] fieldDelimiter, byte[] textDelimiter)
          Instantiates a new delimited text file writer.
 
Method Summary
 void close()
           
 void flush()
           
 void write(java.util.List<java.lang.String> entity)
          Write an entity.
 
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

DelimitedTextFileWriter

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

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

DelimitedTextFileWriter

public DelimitedTextFileWriter(org.apache.hadoop.conf.Configuration configuration,
                               org.apache.hadoop.fs.Path basePath,
                               CodecInfo codec,
                               byte[] fieldDelimiter)
Instantiates a new delimited text file writer.

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

DelimitedTextFileWriter

public DelimitedTextFileWriter(org.apache.hadoop.conf.Configuration configuration,
                               org.apache.hadoop.fs.Path basePath,
                               CodecInfo codec,
                               byte[] fieldDelimiter,
                               byte[] textDelimiter)
Instantiates a new delimited text file writer.

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

write

public void write(java.util.List<java.lang.String> entity)
           throws java.io.IOException
Description copied from interface: DataWriter
Write an entity.

Specified by:
write in interface DataWriter<java.util.List<java.lang.String>>
Throws:
java.io.IOException - if an I/O error occurs

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Throws:
java.io.IOException

close

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

Spring for Apache Hadoop