Public Member Functions | |
LogStringBuffer () | |
void | append (char ch, StringBuilder str) |
String | toString () |
void | dump () |
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.
alma.acs.logging.engine.io.LogStringBuffer.LogStringBuffer | ( | ) |
The constructor
size | The size of the rotating buffer |
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.
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 | ( | ) |