T
- the type of data to writepublic abstract class FileOutputWriter<T> extends java.lang.Object implements OutputWriter<T>
Modifier and Type | Field and Description |
---|---|
protected FileSystem |
fs
File system object
|
protected java.util.Map<java.lang.Integer,FSDataOutputStream> |
openStreams
Opened streams
|
protected Path |
outPath
File output path
|
protected java.io.PrintWriter |
pw |
protected FileSystem.WriteMode |
writeMode
Write mode of the files
|
Constructor and Description |
---|
FileOutputWriter(FileSystem.WriteMode writeMode,
Path outPath) |
FileOutputWriter(FileSystem.WriteMode writeMode,
Path outPath,
Config config) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the writer, flush everything
|
void |
configure(Config config)
Configure the output writer
|
protected abstract void |
createOutput(int partition,
FSDataOutputStream out)
Create a suitable output
|
static java.lang.String |
generateRandom(int length) |
FileSystem.WriteMode |
getWriteMode() |
void |
setWriteMode(FileSystem.WriteMode writeMode) |
void |
write(int partition,
T out)
Add value to output
|
void |
write(T out) |
protected abstract void |
writeRecord(int partition,
T data)
Write the record to output
|
protected abstract void |
writeRecord(T data) |
protected FileSystem fs
protected java.io.PrintWriter pw
protected java.util.Map<java.lang.Integer,FSDataOutputStream> openStreams
protected FileSystem.WriteMode writeMode
protected Path outPath
public FileOutputWriter(FileSystem.WriteMode writeMode, Path outPath)
public FileOutputWriter(FileSystem.WriteMode writeMode, Path outPath, Config config)
public FileSystem.WriteMode getWriteMode()
public void setWriteMode(FileSystem.WriteMode writeMode)
public void write(int partition, T out)
OutputWriter
write
in interface OutputWriter<T>
public void write(T out)
write
in interface OutputWriter<T>
public static java.lang.String generateRandom(int length)
protected abstract void createOutput(int partition, FSDataOutputStream out)
partition
- partition idout
- the out streamprotected abstract void writeRecord(int partition, T data)
partition
- partition iddata
- dataprotected abstract void writeRecord(T data)
public void configure(Config config)
OutputWriter
configure
in interface OutputWriter<T>
config
- configurationpublic void close()
OutputWriter
close
in interface OutputWriter<T>