public class RandomAccessFileManager extends OutputStreamManager
ByteBuffer and a RandomAccessFile to do the
I/O.byteBuffer, layoutcount, 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 isFlush,
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, writeFooterclose, getCount, getLoggerContext, getName, hasManager, log, logDebug, logError, logWarn, release, stop, updateDataprotected 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 isFlush, 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.isFlush - 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)
OutputStreamManagerwriteToDestination in class OutputStreamManagerbytes - the array containing dataoffset - from where to writelength - how many bytes to writepublic void flush()
OutputStreamManagerflush in class OutputStreamManagerpublic boolean closeOutputStream()
closeOutputStream in class OutputStreamManagerpublic String getFileName()
public int getBufferSize()
public Map<String,String> getContentFormat()
Key: "fileURI" Value: provided "advertiseURI" param.
getContentFormat in class AbstractManagerCopyright © 1999-2017. 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.