public class FileRecordWriter extends java.lang.Object implements RecordWriter
Modifier and Type | Field and Description |
---|---|
protected Configuration |
conf |
static java.nio.charset.Charset |
DEFAULT_CHARSET |
protected java.nio.charset.Charset |
encoding |
static java.lang.String |
NEW_LINE |
protected java.io.DataOutputStream |
out |
static java.lang.String |
PATH |
protected java.io.File |
writeTo |
APPEND
Constructor and Description |
---|
FileRecordWriter() |
FileRecordWriter(Configuration conf)
Initialized based on configuration
Set the following attributes in the conf:
|
FileRecordWriter(java.io.File path) |
FileRecordWriter(java.io.File path,
boolean append) |
FileRecordWriter(java.io.File path,
boolean append,
java.nio.charset.Charset encoding) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the recod reader
|
Configuration |
getConf()
Return the configuration used by this object.
|
void |
setConf(Configuration conf)
Set the configuration to be used by this object.
|
void |
write(java.util.Collection<Writable> record)
Write a record
|
public static final java.nio.charset.Charset DEFAULT_CHARSET
protected java.io.File writeTo
protected java.io.DataOutputStream out
public static final java.lang.String NEW_LINE
public static final java.lang.String PATH
protected java.nio.charset.Charset encoding
protected Configuration conf
public FileRecordWriter()
public FileRecordWriter(java.io.File path) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public FileRecordWriter(java.io.File path, boolean append) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public FileRecordWriter(java.io.File path, boolean append, java.nio.charset.Charset encoding) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public FileRecordWriter(Configuration conf) throws java.io.FileNotFoundException
conf
- the configuration to usejava.io.FileNotFoundException
public void write(java.util.Collection<Writable> record) throws java.io.IOException
RecordWriter
write
in interface RecordWriter
record
- the record to writejava.io.IOException
public void close()
RecordWriter
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface RecordWriter
public void setConf(Configuration conf)
Configurable
setConf
in interface Configurable
public Configuration getConf()
Configurable
getConf
in interface Configurable