Public Member Functions

alma.acs.logging.engine.io.LogStringBuffer Class Reference

List of all members.

Public Member Functions

 LogStringBuffer ()
void append (char ch, StringBuilder str)
String toString ()
void dump ()

Detailed Description

LogStringBuffer is a buffer of chars supporting the loading of logs from a file.

The buffer contains the chars read from the file and passed through the append(). For each new chars, append() checks if a closing or an ending XML tag of a log is in the buffer.

When a whole XML representing a log is in the buffer, it is returned to the caller and the buffer cleared to be ready to look for the next XML.
The size of the buffer is initially set to a default value and it is doubled whenever the algorithm needs more room in the array of char.

This functionality was initially implemented encapsulating a StringBuilder property but it was too slow compared to basic chars manipulation.

Author:
acaproni

Constructor & Destructor Documentation

alma.acs.logging.engine.io.LogStringBuffer.LogStringBuffer (  ) 

The constructor

Parameters:
size The size of the rotating buffer

Member Function Documentation

void alma.acs.logging.engine.io.LogStringBuffer.append ( char  ch,
StringBuilder  str 
)

Append a char to the end of the buffer.

This method checks if the buffer contains the XML representing a log entry. The str parameter is used to return the string with a log and must be empty. The method does not perform any check about the content of the passed StringBuilder so it is the caller that must ensure the correctness.

Note: the content of the StringBuilder is changed only and only if there is a whole log in the buffer.

Parameters:
ch The char to append
str A string representing the new log; the content of this parameter is changed if and only if there is a log in the buffer
void alma.acs.logging.engine.io.LogStringBuffer.dump (  ) 
String alma.acs.logging.engine.io.LogStringBuffer.toString (  ) 
Returns:
a String representation of the buffer

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties