public class RandomAccessFileManager extends OutputStreamManager
ByteBuffer
and a RandomAccessFile
to do the
I/O.byteBuffer, layout
count, LOGGER
Modifier | Constructor and Description |
---|---|
protected |
RandomAccessFileManager(LoggerContext loggerContext,
RandomAccessFile file,
String fileName,
OutputStream os,
int bufferSize,
String advertiseURI,
Layout<? extends Serializable> layout,
boolean writeHeader) |
Modifier and Type | Method and Description |
---|---|
boolean |
closeOutputStream() |
void |
flush()
Flushes any buffers.
|
int |
getBufferSize()
Returns the buffer capacity.
|
Map<String,String> |
getContentFormat()
Gets this FileManager's content format specified by:
|
static RandomAccessFileManager |
getFileManager(String fileName,
boolean append,
boolean immediateFlush,
int bufferSize,
String advertiseURI,
Layout<? extends Serializable> layout,
Configuration configuration)
Returns the RandomAccessFileManager.
|
String |
getFileName()
Returns the name of the File being managed.
|
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, writeHeader
close, getCount, getLoggerContext, getName, hasManager, log, logDebug, logError, logger, logWarn, narrow, release, stop, updateData
protected RandomAccessFileManager(LoggerContext loggerContext, RandomAccessFile file, String fileName, OutputStream os, int bufferSize, String advertiseURI, Layout<? extends Serializable> layout, boolean writeHeader)
public static RandomAccessFileManager getFileManager(String fileName, boolean append, boolean immediateFlush, int bufferSize, String advertiseURI, Layout<? extends 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 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 String getFileName()
public int getBufferSize()
public Map<String,String> getContentFormat()
Key: "fileURI" Value: provided "advertiseURI" param.
getContentFormat
in class AbstractManager
Copyright © 1999-2021 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.