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:
Flushable,AutoCloseable
- Direct Known Subclasses:
ConsoleHandler,FileHandler
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.ExtHandler
handlers, handlersUpdater, lock -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance with no formatter.OutputStreamHandler(OutputStream outputStream, Formatter formatter) Construct a new instance.OutputStreamHandler(Formatter formatter) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGet the handler's character set.protected voidsetCharsetPrivate(Charset charset) Set the handler's character set from within this handler.voidsetOutputStream(OutputStream outputStream) Set the output stream to write to.voidSet the writer.Methods inherited from class org.jboss.logmanager.handlers.WriterHandler
close, doPublish, flush, isCheckHeadEncoding, isCheckTailEncoding, preWrite, safeClose, setCheckHeadEncoding, setCheckTailEncodingMethods inherited from class org.jboss.logmanager.ExtHandler
addHandler, checkAccess, checkAccess, clearHandlers, getEncoding, getErrorManager, getFilter, getFormatter, getHandlers, getLevel, isAutoFlush, isCallerCalculationRequired, isCloseChildren, isEnabled, publish, publish, publishToNestedHandlers, removeHandler, reportError, reportError, setAutoFlush, setCharset, setCloseChildren, setEnabled, setEncoding, setErrorManager, setFilter, setFormatter, setHandlers, setLevelMethods inherited from class java.util.logging.Handler
isLoggable
-
Constructor Details
-
OutputStreamHandler
public OutputStreamHandler()Construct a new instance with no formatter. -
OutputStreamHandler
Construct a new instance.- Parameters:
formatter- the formatter to use
-
OutputStreamHandler
Construct a new instance.- Parameters:
outputStream- the output stream to useformatter- the formatter to use
-
-
Method Details
-
setCharsetPrivate
Description copied from class:ExtHandlerSet the handler's character set from within this handler. If not set, the handler's character set is initialized to the platform default character set.- Overrides:
setCharsetPrivatein classExtHandler- Parameters:
charset- the character set (must not benull)- Throws:
SecurityException
-
getCharset
Description copied from class:ExtHandlerGet the handler's character set.- Overrides:
getCharsetin classExtHandler- Returns:
- the character set in use (not
null)
-
setWriter
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
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
-