net.percederberg.mibble
Class MibLoaderLog

java.lang.Object
  extended bynet.percederberg.mibble.MibLoaderLog

public class MibLoaderLog
extends java.lang.Object

A MIB loader log. This class contains error and warning messages from loading a MIB file and all imports not previously loaded.

Since:
2.0

Nested Class Summary
 class MibLoaderLog.LogEntry
          A log entry.
 
Constructor Summary
MibLoaderLog()
          Creates a new loader log without entries.
 
Method Summary
 void add(MibLoaderLog.LogEntry entry)
          Adds a log entry to this log.
 void addAll(MibLoaderLog log)
          Adds all log entries from another log.
 void addError(java.io.File file, int line, int column, java.lang.String message)
          Adds an error message to the log.
 void addError(FileLocation location, java.lang.String message)
          Adds an error message to the log.
 void addInternalError(FileLocation location, java.lang.String message)
          Adds an internal error message to the log.
 void addInternalError(java.io.File file, java.lang.String message)
          Adds an internal error message to the log.
 void addWarning(java.io.File file, int line, int column, java.lang.String message)
          Adds a warning message to the log.
 void addWarning(FileLocation location, java.lang.String message)
          Adds a warning message to the log.
 java.util.Iterator entries()
          Returns an iterator with all the log entries.
 int errorCount()
          Returns the number of errors in the log.
 void printTo(java.io.PrintStream output)
          Prints all log entries to the specified output stream.
 void printTo(java.io.PrintWriter output)
          Prints all log entries to the specified output stream.
 void printTo(java.io.PrintWriter output, int margin)
          Prints all log entries to the specified output stream.
 int warningCount()
          Returns the number of warnings in the log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MibLoaderLog

public MibLoaderLog()
Creates a new loader log without entries.

Method Detail

errorCount

public int errorCount()
Returns the number of errors in the log.

Returns:
the number of errors in the log

warningCount

public int warningCount()
Returns the number of warnings in the log.

Returns:
the number of warnings in the log

add

public void add(MibLoaderLog.LogEntry entry)
Adds a log entry to this log.

Parameters:
entry - the log entry to add

addInternalError

public void addInternalError(FileLocation location,
                             java.lang.String message)
Adds an internal error message to the log. Internal errors are only issued when possible bugs are encountered. They are counted as errors.

Parameters:
location - the file location
message - the error message

addInternalError

public void addInternalError(java.io.File file,
                             java.lang.String message)
Adds an internal error message to the log. Internal errors are only issued when possible bugs are encountered. They are counted as errors.

Parameters:
file - the file affected
message - the error message

addError

public void addError(FileLocation location,
                     java.lang.String message)
Adds an error message to the log.

Parameters:
location - the file location
message - the error message

addError

public void addError(java.io.File file,
                     int line,
                     int column,
                     java.lang.String message)
Adds an error message to the log.

Parameters:
file - the file affected
line - the line number
column - the column number
message - the error message

addWarning

public void addWarning(FileLocation location,
                       java.lang.String message)
Adds a warning message to the log.

Parameters:
location - the file location
message - the warning message

addWarning

public void addWarning(java.io.File file,
                       int line,
                       int column,
                       java.lang.String message)
Adds a warning message to the log.

Parameters:
file - the file affected
line - the line number
column - the column number
message - the warning message

addAll

public void addAll(MibLoaderLog log)
Adds all log entries from another log.

Parameters:
log - the MIB loader log

entries

public java.util.Iterator entries()
Returns an iterator with all the log entries. The iterator will only return LogEntry instances.

Returns:
an iterator with all the log entries
Since:
2.2
See Also:
MibLoaderLog.LogEntry

printTo

public void printTo(java.io.PrintStream output)
Prints all log entries to the specified output stream.

Parameters:
output - the output stream to use

printTo

public void printTo(java.io.PrintWriter output)
Prints all log entries to the specified output stream.

Parameters:
output - the output stream to use

printTo

public void printTo(java.io.PrintWriter output,
                    int margin)
Prints all log entries to the specified output stream.

Parameters:
output - the output stream to use
margin - the print margin
Since:
2.2