public abstract class AbstractLogStreamHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.nio.charset.Charset |
charset |
protected ICompressionFilter |
compressionFilter |
protected java.lang.String |
extension |
protected boolean |
flushLogFile |
protected int |
numOfBytes |
protected int |
numOfEntries |
protected java.nio.channels.WritableByteChannel |
outputChannel |
protected java.io.OutputStream |
serializedStream |
protected IValueSerializer |
serializer |
protected WriterRegistry |
writerRegistry |
Constructor and Description |
---|
AbstractLogStreamHandler(java.lang.Boolean flushLogFile,
java.lang.Integer bufferSize,
java.nio.charset.Charset charset,
ICompressionFilter compressionFilter,
WriterRegistry writerRegistry)
Create an abstract log stream handler.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the log file.
|
java.lang.String |
getFileExtension()
Get the file extension for the stream.
|
long |
getNumOfBytes()
Return the number of written bytes.
|
int |
getNumOfEntries()
Return the number of written entries.
|
void |
initialize(java.io.OutputStream serializedOutputStream,
java.nio.file.Path fileName)
Initialize a new stream.
|
abstract void |
serialize(IMonitoringRecord record,
int id)
Serialize a record.
|
protected final boolean flushLogFile
protected final ICompressionFilter compressionFilter
protected int numOfEntries
protected final WriterRegistry writerRegistry
protected final java.nio.charset.Charset charset
protected IValueSerializer serializer
protected java.io.OutputStream serializedStream
protected java.nio.channels.WritableByteChannel outputChannel
protected int numOfBytes
protected java.lang.String extension
public AbstractLogStreamHandler(java.lang.Boolean flushLogFile, java.lang.Integer bufferSize, java.nio.charset.Charset charset, ICompressionFilter compressionFilter, WriterRegistry writerRegistry)
flushLogFile
- flag indicating whether the file should be flushed after every written recordbufferSize
- buffer sizercharset
- character set used for serializationcompressionFilter
- compression filterwriterRegistry
- string registrypublic void initialize(java.io.OutputStream serializedOutputStream, java.nio.file.Path fileName) throws java.io.IOException
serializedOutputStream
- stream to be usedfileName
- file name of the stream, this is used by some compression filtersjava.io.IOException
- when the creation of the channel failspublic int getNumOfEntries()
public long getNumOfBytes()
public void close() throws java.io.IOException
java.io.IOException
- on io errorpublic java.lang.String getFileExtension()
public abstract void serialize(IMonitoringRecord record, int id) throws java.io.IOException
record
- the record itselfid
- the type id from the string registryjava.io.IOException
- on io errors, e.g., write errorsCopyright 2020 Kieker Project, http://kieker-monitoring.net