Package org.jboss.logmanager.handlers
Class OutputStreamHandler
- java.lang.Object
-
- java.util.logging.Handler
-
- org.jboss.logmanager.ExtHandler
-
- org.jboss.logmanager.handlers.WriterHandler
-
- org.jboss.logmanager.handlers.OutputStreamHandler
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable,FlushableCloseable,Protectable
- Direct Known Subclasses:
ConsoleHandler,FileHandler
public class OutputStreamHandler extends WriterHandler
An output stream handler which supports anyOutputStream, 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
Constructors Constructor Description OutputStreamHandler()Construct a new instance with no formatter.OutputStreamHandler(java.io.OutputStream outputStream, java.util.logging.Formatter formatter)Construct a new instance.OutputStreamHandler(java.util.logging.Formatter formatter)Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetEncoding()Get the target encoding.voidsetEncoding(java.lang.String encoding)Set the target encoding.voidsetOutputStream(java.io.OutputStream outputStream)Set the output stream to write to.voidsetWriter(java.io.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, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isCallerCalculationRequired, isCloseChildren, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setCloseChildren, setEnabled, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotect
-
-
-
-
Constructor Detail
-
OutputStreamHandler
public OutputStreamHandler()
Construct a new instance with no formatter.
-
OutputStreamHandler
public OutputStreamHandler(java.util.logging.Formatter formatter)
Construct a new instance.- Parameters:
formatter- the formatter to use
-
OutputStreamHandler
public OutputStreamHandler(java.io.OutputStream outputStream, java.util.logging.Formatter formatter)Construct a new instance.- Parameters:
outputStream- the output stream to useformatter- the formatter to use
-
-
Method Detail
-
getEncoding
public java.lang.String getEncoding()
Get the target encoding.- Overrides:
getEncodingin classjava.util.logging.Handler- Returns:
- the target encoding, or
nullif the platform default is being used
-
setEncoding
public void setEncoding(java.lang.String encoding) throws java.lang.SecurityException, java.io.UnsupportedEncodingExceptionSet the target encoding.- Overrides:
setEncodingin classExtHandler- Parameters:
encoding- the new encoding- Throws:
java.lang.SecurityException- if you do not have sufficient permission to invoke this operationjava.io.UnsupportedEncodingException- if the specified encoding is not supported
-
setWriter
public void setWriter(java.io.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:
setWriterin classWriterHandler- Parameters:
writer- the new writer, ornullto disable logging
-
setOutputStream
public void setOutputStream(java.io.OutputStream outputStream)
Set the output stream to write to. The output stream will then belong to this handler; when the handler is closed or a new writer or output stream is set, this output stream will be closed.- Parameters:
outputStream- the new output stream ornullfor none
-
-