Public Member Functions | |
synchronized long | loadLogs (String fileName, ACSRemoteLogListener logListener, ACSRemoteRawLogListener rawLogListener, ACSRemoteErrorListener errorListener, IOPorgressListener progressListener, boolean gzip) throws IOException, Exception |
synchronized long | loadLogs (String fileName, ACSRemoteLogListener logListener, ACSRemoteRawLogListener rawLogListener, ACSRemoteErrorListener errorListener, IOPorgressListener progressListener) throws IOException, Exception |
synchronized void | loadLogs (BufferedReader reader, ACSRemoteLogListener logListener, ACSRemoteRawLogListener rawLogListener, ACSRemoteErrorListener errorListener, IOPorgressListener progressListener) throws IOException, Exception |
synchronized void | writeHeader (BufferedWriter wBuffer) throws IOException |
synchronized void | terminateSave (BufferedWriter outBuffer, boolean close) throws IOException |
synchronized int | saveLog (BufferedWriter outBuf, ILogEntry log) throws IOException |
synchronized void | saveLogs (String fileName, Collection< ILogEntry > logs, IOPorgressListener progressListener, boolean append, boolean gzip) throws IOException |
synchronized void | saveLogs (String fileName, Collection< ILogEntry > logs, IOPorgressListener progressListener, boolean append, boolean gzip, int compressionLevel) throws IOException |
synchronized void | saveLogs (BufferedWriter outBuffer, Collection< ILogEntry > logs, IOPorgressListener progressListener) throws IOException |
synchronized void | saveLogs (String fileName, Iterator< ILogEntry >iterator, IOPorgressListener progressListener, boolean append, boolean gzip) throws IOException |
synchronized void | saveLogs (String fileName, Iterator< ILogEntry >iterator, IOPorgressListener progressListener, boolean append, boolean gzip, int compressionLevel) throws IOException |
synchronized BufferedWriter | getBufferedWriter (String fileName, boolean append, boolean gzip, int compressionLevel) throws FileNotFoundException, IOException |
synchronized BufferedWriter | getBufferedWriter (String fileName, boolean append, boolean gzip) throws FileNotFoundException, IOException |
synchronized BufferedReader | getBufferedReader (String fileName) throws FileNotFoundException, IOException |
synchronized void | saveLogs (BufferedWriter outBuf, Iterator< ILogEntry > iterator, IOPorgressListener progressListener) throws IOException |
void | stopIO () |
Static Public Attributes | |
final int | DEFAULT_COMPRESSION_LEVEL = 5 |
Protected Attributes | |
volatile boolean | stopped = false |
Private Member Functions | |
void | injectLog (StringBuilder logStr, ACSRemoteLogListener logListener, ACSRemoteRawLogListener rawLogListener, ACSRemoteErrorListener errorListener) |
Private Attributes | |
ACSLogParser | parser |
Load and save methods are executed in a synchronous way i.e. they do not return until the I/O is terminated (or an exception occurs).
Intermediate results useful to monitor the progress of the I/O are communicated to the listeners implementing the IOProgressListener
interface.
The load and save methods of this class are synchronized
but I would not say that this class is thread safe because it does not hold and lock the objects it receives as parameters like for example the BufferReader
and the BufferWriter
. So thread safety must be ensured by the owner of such objects.
Loading
The loading is performed through one of the overloaded loadLogs
methods. The bytes read and the number of the logs successfully read are sent to the listeners implementing the IOProgressListener
interface. If there are filters, an audience or a discard level defined, then each log is checked before being sent to the listener.
Saving
The saving of logs can be done by passing a Collection
of logs or an Iterator
to one of the overloaded saveLogs
methods. Such methods communicates the progress to the listener implementing the IOProgressListener
interface.
Saving logs by passing the name of the file does not require any extra steps.
Saving logs by passing a BufferedWriter
is always a three steps procedure:
prepareSaveFile
to write XML header saveLogs
or the saveLog
Save
to add the closing XML tags, flush and close the buffer
Load and save can be very long operations. To stop an I/O, the stopIO()
must be executed.
|
Return the reader to get logs from The reader can be compressed (GZIP) or not depending on the extension of the file name (i.e. ".gz" or ".xml").
|
|
Create a In case of compressed files, the default compression level is used
|
|
Create a
|
|
Inject the log into the engine
|
|
Load the logs from the given
The logs are sent to the
The size of the buffer The buffer of data read from the file The cursor to scan the buffer (circular) When it is 0, then we have to read another block from the file |
|
Load the logs from the file with the given name.
The logs are sent to the The file can be compressed (GZIP) or plain. Compressed file names must terminate with .gz while plain XML file names must end with .xml.
|
|
Load the logs from the file with the given name.
The logs are sent to the
|
|
Save a log in the passed file
|
|
Save a collection of logs on a
The buffer must be initialized and terminated i.e. the
|
|
Save the logs available through an
|
|
Save the logs available through an
|
|
Save a collection of logs on a
The buffer must be initialized and terminated i.e. the
|
|
Save a collection of logs on disk
|
|
Save a collection of logs on disk
|
|
Call this method if you wish to interrupt a load or a save. Load and save are executed synchronously so this method has to be called by a separate thread. A typical example is the "Abort" button of a dialog: when the user presses such a button, this method is invoked by the swing thread. |
|
Terminate the saving. This method must executed when the save terminates. It does the following:
|
|
Write the XML header in the buffered writer
|
|
The default compression level while saving files |
|
The parser |
|
Signal that a load or a save must be stopped |