public class RandomAccessFileManager extends OutputStreamManager
ByteBuffer
and a RandomAccessFile
to do the
I/O.Modifier and Type | Class and Description |
---|---|
private static class |
RandomAccessFileManager.FactoryData
Factory Data.
|
private static class |
RandomAccessFileManager.RandomAccessFileManagerFactory
Factory to create a RandomAccessFileManager.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
advertiseURI |
(package private) static int |
DEFAULT_BUFFER_SIZE |
private static RandomAccessFileManager.RandomAccessFileManagerFactory |
FACTORY |
private java.lang.ThreadLocal<java.lang.Boolean> |
isEndOfBatch |
private java.io.RandomAccessFile |
randomAccessFile |
byteBuffer, layout
count, LOGGER
Modifier | Constructor and Description |
---|---|
protected |
RandomAccessFileManager(LoggerContext loggerContext,
java.io.RandomAccessFile file,
java.lang.String fileName,
java.io.OutputStream os,
int bufferSize,
java.lang.String advertiseURI,
Layout<? extends java.io.Serializable> layout,
boolean writeHeader) |
Modifier and Type | Method and Description |
---|---|
boolean |
closeOutputStream() |
void |
flush()
Flushes any buffers.
|
int |
getBufferSize()
Returns the buffer capacity.
|
java.util.Map<java.lang.String,java.lang.String> |
getContentFormat()
Gets this FileManager's content format specified by:
|
static RandomAccessFileManager |
getFileManager(java.lang.String fileName,
boolean append,
boolean immediateFlush,
int bufferSize,
java.lang.String advertiseURI,
Layout<? extends java.io.Serializable> layout,
Configuration configuration)
Returns the RandomAccessFileManager.
|
java.lang.String |
getFileName()
Returns the name of the File being managed.
|
java.lang.Boolean |
isEndOfBatch() |
void |
setEndOfBatch(boolean endOfBatch) |
protected void |
writeToDestination(byte[] bytes,
int offset,
int length)
Writes the specified section of the specified byte array to the stream.
|
createOutputStream, drain, flushBuffer, flushDestination, getByteBuffer, getManager, getOutputStream, hasOutputStream, isOpen, releaseSub, setOutputStream, skipFooter, write, write, write, write, writeBytes, writeBytes, writeFooter
close, getCount, getLoggerContext, getName, hasManager, log, logDebug, logError, logger, logWarn, narrow, release, stop, updateData
static final int DEFAULT_BUFFER_SIZE
private static final RandomAccessFileManager.RandomAccessFileManagerFactory FACTORY
private final java.lang.String advertiseURI
private final java.io.RandomAccessFile randomAccessFile
private final java.lang.ThreadLocal<java.lang.Boolean> isEndOfBatch
protected RandomAccessFileManager(LoggerContext loggerContext, java.io.RandomAccessFile file, java.lang.String fileName, java.io.OutputStream os, int bufferSize, java.lang.String advertiseURI, Layout<? extends java.io.Serializable> layout, boolean writeHeader)
public static RandomAccessFileManager getFileManager(java.lang.String fileName, boolean append, boolean immediateFlush, int bufferSize, java.lang.String advertiseURI, Layout<? extends java.io.Serializable> layout, Configuration configuration)
fileName
- The name of the file to manage.append
- true if the file should be appended to, false if it should
be overwritten.immediateFlush
- true if the contents should be flushed to disk on every
writebufferSize
- The buffer size.advertiseURI
- the URI to use when advertising the filelayout
- The layout.configuration
- The configuration.public java.lang.Boolean isEndOfBatch()
public void setEndOfBatch(boolean endOfBatch)
protected void writeToDestination(byte[] bytes, int offset, int length)
OutputStreamManager
writeToDestination
in class OutputStreamManager
bytes
- the array containing dataoffset
- from where to writelength
- how many bytes to writepublic void flush()
OutputStreamManager
flush
in class OutputStreamManager
public boolean closeOutputStream()
closeOutputStream
in class OutputStreamManager
public java.lang.String getFileName()
public int getBufferSize()
public java.util.Map<java.lang.String,java.lang.String> getContentFormat()
Key: "fileURI" Value: provided "advertiseURI" param.
getContentFormat
in class AbstractManager