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

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

public class DelimitedTextFileWriter
extends Object
implements DataStoreWriter<List<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(Configuration configuration, Path basePath, CodecInfo codec)
          Instantiates a new delimited text file writer.
DelimitedTextFileWriter(Configuration configuration, Path basePath, CodecInfo codec, byte[] fieldDelimiter)
          Instantiates a new delimited text file writer.
DelimitedTextFileWriter(Configuration configuration, Path basePath, CodecInfo codec, byte[] fieldDelimiter, byte[] textDelimiter)
          Instantiates a new delimited text file writer.
 
Method Summary
 void close()
           
 void flush()
           
 void write(List<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(Configuration configuration,
                               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(Configuration configuration,
                               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(Configuration configuration,
                               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(List<String> entity)
           throws IOException
Description copied from interface: DataWriter
Write an entity.

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

flush

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

close

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