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.FileNotFoundExceptionpublic FileRecordWriter(java.io.File path,
boolean append)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic FileRecordWriter(java.io.File path,
boolean append,
java.nio.charset.Charset encoding)
throws java.io.FileNotFoundException
java.io.FileNotFoundExceptionpublic FileRecordWriter(Configuration conf) throws java.io.FileNotFoundException
conf - the configuration to usejava.io.FileNotFoundExceptionpublic void write(java.util.Collection<Writable> record) throws java.io.IOException
RecordWriterwrite in interface RecordWriterrecord - the record to writejava.io.IOExceptionpublic void close()
RecordWriterclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface RecordWriterpublic void setConf(Configuration conf)
ConfigurablesetConf in interface Configurablepublic Configuration getConf()
ConfigurablegetConf in interface Configurable