org.salespointframework.core.logging
Class LogFileContent

java.lang.Object
  extended by org.salespointframework.core.logging.LogFileContent

public class LogFileContent
extends java.lang.Object

Represents the content of a log file.

This class takes a log file or a LogInputStream as parameter, reads all LogEntries from that file and stores them in a List.

Having all LogEntries in a List, makes it easy to display them in a LogTableForm or writing them to the persistence file when saving the Shop's state.

Since:
v3.1
Author:
Andreas Bartho

Field Summary
private  java.util.List<LogEntry> m_lContentList
          The list which contains all Entries from the log file.
 
Constructor Summary
LogFileContent(java.io.File f)
          Creates a LogFileContent.
LogFileContent(LogInputStream lis)
          Creates a LogFileContent.
 
Method Summary
 java.util.List<LogEntry> getContentList()
           
private  java.util.List<LogEntry> streamToList(LogInputStream lis)
          Does the actual conversion from a LogInputStream to a list of LogEntries.
 void update(java.io.File f)
          Replaces all currently saved LogEntries with new ones.
 void update(LogInputStream lis)
          Replaces all currently saved LogEntries with new ones.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_lContentList

private java.util.List<LogEntry> m_lContentList
The list which contains all Entries from the log file.

Constructor Detail

LogFileContent

public LogFileContent(java.io.File f)
Creates a LogFileContent. All LogEntries are read from the passed log file and stored in a list.

Parameters:
f - the file to be read from.

LogFileContent

public LogFileContent(LogInputStream lis)
Creates a LogFileContent. All LogEntries are read from the passed LogInputStream and stored in a list.

Parameters:
lis - the LogInputStream to be read from.
Method Detail

update

public void update(java.io.File f)
Replaces all currently saved LogEntries with new ones.

Parameters:
f - the log file to be read from

update

public void update(LogInputStream lis)
Replaces all currently saved LogEntries with new ones.

Parameters:
lis - the LogInputStream to be read from.

getContentList

public java.util.List<LogEntry> getContentList()
Returns:
the List of currently saved LogEntries

streamToList

private java.util.List<LogEntry> streamToList(LogInputStream lis)
Does the actual conversion from a LogInputStream to a list of LogEntries.

Parameters:
lis - the LogInputStream to be read from
Returns:
a List with all LogEntries from the LogInputStream