com.puppycrawl.tools.checkstyle

Class XMLLogger

public class XMLLogger extends AutomaticBean implements AuditListener

Simple XML logger. It outputs everything in UTF8 (default XML encoding is UTF8) in case we want to localize error messages or simply that filenames are localized and takes care about escaping as well.

Author: Stephane Bailliez

Constructor Summary
XMLLogger(OutputStream aOS, boolean aCloseStream)
Creates a new XMLLogger instance.
Method Summary
voidaddError(AuditEvent aEvt)
{@inheritDoc}
voidaddException(AuditEvent aEvt, Throwable aThrowable)
{@inheritDoc}
voidauditFinished(AuditEvent aEvt)
{@inheritDoc}
voidauditStarted(AuditEvent aEvt)
{@inheritDoc}
Stringencode(String aValue)
Escape <, > & ' and " as their entities.
voidfileFinished(AuditEvent aEvt)
{@inheritDoc}
voidfileStarted(AuditEvent aEvt)
{@inheritDoc}
booleanisReference(String aEnt)

Constructor Detail

XMLLogger

public XMLLogger(OutputStream aOS, boolean aCloseStream)
Creates a new XMLLogger instance. Sets the output to a defined stream.

Parameters: aOS the stream to write logs to. aCloseStream close aOS in auditFinished

Method Detail

addError

public void addError(AuditEvent aEvt)
{@inheritDoc}

addException

public void addException(AuditEvent aEvt, Throwable aThrowable)
{@inheritDoc}

auditFinished

public void auditFinished(AuditEvent aEvt)
{@inheritDoc}

auditStarted

public void auditStarted(AuditEvent aEvt)
{@inheritDoc}

encode

public String encode(String aValue)
Escape <, > & ' and " as their entities.

Parameters: aValue the value to escape.

Returns: the escaped value if necessary.

fileFinished

public void fileFinished(AuditEvent aEvt)
{@inheritDoc}

fileStarted

public void fileStarted(AuditEvent aEvt)
{@inheritDoc}

isReference

public boolean isReference(String aEnt)

Parameters: aEnt the possible entity to look for.

Returns: whether the given argument a character or entity reference