JBoss LogManager 1.1.0.CR6

org.jboss.logmanager.handlers
Class OutputStreamHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.jboss.logmanager.ExtHandler
          extended by org.jboss.logmanager.handlers.WriterHandler
              extended by org.jboss.logmanager.handlers.OutputStreamHandler
All Implemented Interfaces:
Flushable
Direct Known Subclasses:
ConsoleHandler, FileHandler

public class OutputStreamHandler
extends WriterHandler

An output stream handler which supports any OutputStream, using the specified encoding. If no encoding is specified, the platform default is used.


Field Summary
 
Fields inherited from class org.jboss.logmanager.handlers.WriterHandler
outputLock
 
Fields inherited from class org.jboss.logmanager.ExtHandler
handlers, handlersUpdater
 
Constructor Summary
OutputStreamHandler()
          Construct a new instance with no formatter.
OutputStreamHandler(Formatter formatter)
          Construct a new instance.
OutputStreamHandler(OutputStream outputStream, Formatter formatter)
          Construct a new instance.
 
Method Summary
 String getEncoding()
          Get the target encoding.
 void setEncoding(String encoding)
          Set the target encoding.
 void setOutputStream(OutputStream outputStream)
          Set the output stream to write to.
 void setWriter(Writer writer)
          Set the writer.
 
Methods inherited from class org.jboss.logmanager.handlers.WriterHandler
close, doPublish, flush, preWrite, safeClose
 
Methods inherited from class org.jboss.logmanager.ExtHandler
addHandler, checkAccess, clearHandlers, getHandlers, isAutoFlush, publish, publish, removeHandler, setAutoFlush, setHandlers
 
Methods inherited from class java.util.logging.Handler
getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OutputStreamHandler

public OutputStreamHandler()
Construct a new instance with no formatter.


OutputStreamHandler

public OutputStreamHandler(Formatter formatter)
Construct a new instance.

Parameters:
formatter - the formatter to use

OutputStreamHandler

public OutputStreamHandler(OutputStream outputStream,
                           Formatter formatter)
Construct a new instance.

Parameters:
outputStream - the output stream to use
formatter - the formatter to use
Method Detail

getEncoding

public String getEncoding()
Get the target encoding.

Overrides:
getEncoding in class Handler
Returns:
the target encoding, or null if the platform default is being used

setEncoding

public void setEncoding(String encoding)
                 throws SecurityException,
                        UnsupportedEncodingException
Set the target encoding.

Overrides:
setEncoding in class Handler
Parameters:
encoding - the new encoding
Throws:
SecurityException - if you do not have sufficient permission to invoke this operation
UnsupportedEncodingException - if the specified encoding is not supported

setWriter

public void setWriter(Writer writer)
Set the writer. The writer will then belong to this handler; when the handler is closed or a new writer is set, this writer will be closed. Setting a writer will replace any target output stream.

Overrides:
setWriter in class WriterHandler
Parameters:
writer - the new writer, or null to disable logging

setOutputStream

public void setOutputStream(OutputStream outputStream)
Set the output stream to write to.

Parameters:
outputStream - the new output stream or null for none

JBoss LogManager 1.1.0.CR6

Copyright © 2009 JBoss, a division of Red Hat, Inc.