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
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.ExtHandler
handlers, handlersUpdater, lock
-
-
Constructor Summary
Constructors Constructor Description OutputStreamHandler()
Construct a new instance with no formatter.OutputStreamHandler(OutputStream outputStream, Formatter formatter)
Construct a new instance.OutputStreamHandler(Formatter formatter)
Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Charset
getCharset()
Get the handler's character set.protected void
setCharsetPrivate(Charset charset)
Set the handler's character set from within this handler.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, isCheckHeadEncoding, isCheckTailEncoding, preWrite, safeClose, setCheckHeadEncoding, setCheckTailEncoding
-
Methods 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, setLevel
-
Methods inherited from class java.util.logging.Handler
isLoggable
-
-
-
-
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 useformatter
- the formatter to use
-
-
Method Detail
-
setCharsetPrivate
protected void setCharsetPrivate(Charset charset) throws SecurityException
Description copied from class:ExtHandler
Set 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:
setCharsetPrivate
in classExtHandler
- Parameters:
charset
- the character set (must not benull
)- Throws:
SecurityException
-
getCharset
public Charset getCharset()
Description copied from class:ExtHandler
Get the handler's character set.- Overrides:
getCharset
in classExtHandler
- Returns:
- the character set in use (not
null
)
-
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 classWriterHandler
- Parameters:
writer
- the new writer, ornull
to disable logging
-
setOutputStream
public void setOutputStream(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 ornull
for none
-
-