java.lang.Object | ||
↳ | java.util.logging.Handler | |
↳ | java.util.logging.StreamHandler |
Known Direct Subclasses |
A StreamHandler
object writes log messages to an output stream, that is, objects of the class OutputStream
.
A StreamHandler
object reads the following properties from the log manager to initialize itself. A default value will be used if a property is not found or has an invalid value.
Filter
is used by default. java.util.logging.SimpleFormatter
. Level.INFO
. This class is not thread-safe.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Constructs a
StreamHandler object.
|
||||||||||
|
Constructs a
StreamHandler object with the supplied output stream and formatter.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Closes this handler.
|
||||||||||
|
Flushes any buffered output.
|
||||||||||
|
Determines whether the supplied log record needs to be logged.
|
||||||||||
|
Accepts a logging request.
|
||||||||||
|
Sets the character encoding used by this handler.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Sets the output stream this handler writes to.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.util.logging.Handler
|
|||||||||||
From class java.lang.Object
|
Constructs a StreamHandler
object. The new stream handler does not have an associated output stream.
Constructs a StreamHandler
object with the supplied output stream and formatter.
os | the output stream this handler writes to. |
---|---|
formatter | the formatter this handler uses to format the output. |
NullPointerException | if os or formatter is null . |
---|
Closes this handler. The tail string of the formatter associated with this handler is written out. A flush operation and a subsequent close operation is then performed upon the output stream. Client applications should not use a handler after closing it.
Determines whether the supplied log record needs to be logged. The logging levels are checked as well as the filter. The output stream of this handler is also checked. If it is null
, this method returns false
.
Notice : Case of no output stream will return false
.
record | the log record to be checked. |
---|
true
if record
needs to be logged, false
otherwise. Accepts a logging request. The log record is formatted and written to the output stream if the following three conditions are met:
null
. record | the log record to be logged. |
---|
Sets the character encoding used by this handler. A null
value indicates that the default encoding should be used.
encoding | the character encoding to set. |
---|
UnsupportedEncodingException | if the specified encoding is not supported by the runtime. |
---|
Sets the output stream this handler writes to. If there's an existing output stream, the tail string of the associated formatter will be written to it. Then it will be flushed, closed and replaced with os
.
os | the new output stream. |
---|
NullPointerException | if os is null . |
---|