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:
Closeable, Flushable, AutoCloseable, FlushableCloseable, Protectable
- 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
FieldsFields inherited from class WriterHandler
outputLockFields inherited from class ExtHandler
handlers, handlersUpdater -
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 target encoding.voidsetEncoding(String encoding) Set the target encoding.voidsetOutputStream(OutputStream outputStream) Set the output stream to write to.voidSet the writer.private voidupdateWriter(OutputStream newOutputStream, String encoding) Methods inherited from class ExtHandler
addHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setEnabled, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotectMethods inherited from class Handler
getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError
-
Field Details
-
outputStream
-
-
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
-
getEncoding
Get the target encoding.- Overrides:
getEncodingin classHandler- Returns:
- the target encoding, or
nullif the platform default is being used
-
setEncoding
Set the target encoding.- Overrides:
setEncodingin classExtHandler- Parameters:
encoding- the new encoding- Throws:
SecurityException- if you do not have sufficient permission to invoke this operationUnsupportedEncodingException- if the specified encoding is not supported
-
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.- Parameters:
outputStream- the new output stream ornullfor none
-
updateWriter
private void updateWriter(OutputStream newOutputStream, String encoding) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-