Class AbstractLogStreamHandler

java.lang.Object
kieker.monitoring.writer.filesystem.AbstractLogStreamHandler
Direct Known Subclasses:
BinaryLogStreamHandler, TextLogStreamHandler

public abstract class AbstractLogStreamHandler
extends java.lang.Object
Abstract class for log stream handler. As log stream handler share a lot of functionality, we use an abstract class instead of an interface to define the API and implement common functionality.
Since:
1.14
Author:
Reiner Jung
  • Field Details

  • Constructor Details

    • AbstractLogStreamHandler

      public AbstractLogStreamHandler​(java.lang.Boolean flushLogFile, java.lang.Integer bufferSize, java.nio.charset.Charset charset, ICompressionFilter compressionFilter, WriterRegistry writerRegistry)
      Create an abstract log stream handler.
      Parameters:
      flushLogFile - flag indicating whether the file should be flushed after every written record
      bufferSize - buffer sizer
      charset - character set used for serialization
      compressionFilter - compression filter
      writerRegistry - string registry
  • Method Details

    • initialize

      public void initialize​(java.io.OutputStream serializedOutputStream, java.nio.file.Path fileName) throws java.io.IOException
      Initialize a new stream.
      Parameters:
      serializedOutputStream - stream to be used
      fileName - file name of the stream, this is used by some compression filters
      Throws:
      java.io.IOException - when the creation of the channel fails
    • getNumOfEntries

      public int getNumOfEntries()
      Return the number of written entries.
      Returns:
      number of entries
    • getNumOfBytes

      public long getNumOfBytes()
      Return the number of written bytes.
      Returns:
      number of bytes
    • close

      public void close() throws java.io.IOException
      Close the log file.
      Throws:
      java.io.IOException - on io error
    • getFileExtension

      public java.lang.String getFileExtension()
      Get the file extension for the stream.
      Returns:
      return the file extension
    • serialize

      public abstract void serialize​(IMonitoringRecord record, int id) throws java.io.IOException
      Serialize a record.
      Parameters:
      record - the record itself
      id - the type id from the string registry
      Throws:
      java.io.IOException - on io errors, e.g., write errors