public class TextFileWriter extends AbstractDataStreamWriter implements DataStoreWriter<java.lang.String>
TextFileWriter
is a DataStoreWriter
implementation
able to write String
s into raw hdfs files.DEFAULT_MAX_OPEN_ATTEMPTS
Constructor and Description |
---|
TextFileWriter(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.fs.Path basePath,
CodecInfo codec)
Instantiates a new text file writer.
|
TextFileWriter(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.fs.Path basePath,
CodecInfo codec,
byte[] delimiter)
Instantiates a new text file writer.
|
TextFileWriter(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.fs.Path basePath,
CodecInfo codec,
byte[] delimiter,
long idleTimeout)
Instantiates a new text file writer.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
protected void |
flushTimeout()
Handle flush timeout.
|
protected void |
handleTimeout()
Handle idle timeout.
|
void |
write(java.lang.String entity)
Write an entity.
|
getOutput, getPosition, setMaxOpenAttempts
findInitFiles, getOutputContext, getResolvedPath, initOutputContext, isAppendable, isFileWriteable, isOverwrite, isSyncable, onInit, renameFile, setAppendable, setFileNamingStrategy, setInWritingPrefix, setInWritingSuffix, setOverwrite, setRolloverStrategy, setSyncable, setWritePosition
doStart, doStop, getCodec, getConfiguration, getPath, isCompressed, resetIdleTimeout, setCloseTimeout, setFlushTimeout, setIdleTimeout
afterPropertiesSet, getBeanFactory, getPhase, getStoreEventPublisher, getTaskExecutor, getTaskScheduler, isAutoStartup, isRunning, setAutoStartup, setBeanFactory, setPhase, setStoreEventPublisher, setTaskExecutor, setTaskScheduler, start, stop, stop
public TextFileWriter(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec)
configuration
- the hadoop configurationbasePath
- the hdfs pathcodec
- the compression codec infopublic TextFileWriter(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec, byte[] delimiter)
configuration
- the hadoop configurationbasePath
- the hdfs pathcodec
- the compression codec infodelimiter
- the delimiterpublic TextFileWriter(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path basePath, CodecInfo codec, byte[] delimiter, long idleTimeout)
configuration
- the hadoop configurationbasePath
- the hdfs pathcodec
- the compression codec infodelimiter
- the delimiteridleTimeout
- the idle timeoutpublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
public void write(java.lang.String entity) throws java.io.IOException
DataWriter
write
in interface DataWriter<java.lang.String>
entity
- the entity to writejava.io.IOException
- if an I/O error occursprotected void handleTimeout()
StoreObjectSupport
handleTimeout
in class StoreObjectSupport
protected void flushTimeout()
StoreObjectSupport
flushTimeout
in class StoreObjectSupport