public class RandomAccessFileManager extends OutputStreamManager
ByteBuffer
and a RandomAccessFile
to do the
I/O.layout
count, LOGGER
Modifier | Constructor and Description |
---|---|
protected |
RandomAccessFileManager(RandomAccessFile file,
String fileName,
OutputStream os,
boolean immediateFlush,
int bufferSize,
String advertiseURI,
Layout<? extends Serializable> layout) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
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)
Returns the RandomAccessFileManager.
|
String |
getFileName()
Returns the name of the File being managed.
|
Boolean |
isEndOfBatch() |
void |
setEndOfBatch(boolean isEndOfBatch) |
protected void |
write(byte[] bytes,
int offset,
int length)
Some output streams synchronize writes while others do not.
|
getManager, getOutputStream, isOpen, releaseSub, setOutputStream, write, writeFooter
getCount, getName, hasManager, release
protected RandomAccessFileManager(RandomAccessFile file, String fileName, OutputStream os, boolean immediateFlush, int bufferSize, String advertiseURI, Layout<? extends Serializable> layout)
public static RandomAccessFileManager getFileManager(String fileName, boolean append, boolean isFlush, int bufferSize, String advertiseURI, Layout<? extends Serializable> layout)
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.public Boolean isEndOfBatch()
public void setEndOfBatch(boolean isEndOfBatch)
protected void write(byte[] bytes, int offset, int length)
OutputStreamManager
write
in class OutputStreamManager
bytes
- The serialized Log event.offset
- The offset into the byte array.length
- The number of bytes to write.public void flush()
OutputStreamManager
flush
in class OutputStreamManager
public void close()
close
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 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.