IT. Expert System.

Android Reference



Class StreamHandler

  • Direct Known Subclasses:
    ConsoleHandler, FileHandler, SocketHandler

    public class StreamHandler
    extends Handler
    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.

    • java.util.logging.StreamHandler.encoding specifies the encoding this handler will use to encode log messages. Default is the encoding used by the current platform.
    • java.util.logging.StreamHandler.filter specifies the name of the filter class to be associated with this handler. No Filter is used by default.
    • java.util.logging.StreamHandler.formatter specifies the name of the formatter class to be associated with this handler. Default is java.util.logging.SimpleFormatter.
    • java.util.logging.StreamHandler.level specifies the logging level. Defaults is Level.INFO.

    This class is not thread-safe.

    • Constructor Detail

      • StreamHandler

        public StreamHandler()
        Constructs a StreamHandler object. The new stream handler does not have an associated output stream.
      • StreamHandler

        public StreamHandler(OutputStream os,
                     Formatter formatter)
        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.
    • Method Detail

      • setOutputStream

        protected void setOutputStream(OutputStream os)
        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.
      • close

        public void close()
        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.
        Specified by:
        close in class Handler
      • flush

        public void flush()
        Flushes any buffered output.
        Specified by:
        flush in class Handler
      • publish

        public void publish(LogRecord record)
        Accepts a logging request. The log record is formatted and written to the output stream if the following three conditions are met:
        • the supplied log record has at least the required logging level;
        • the supplied log record passes the filter associated with this handler, if any;
        • the output stream associated with this handler is not null.
        If it is the first time a log record is written out, the head string of the formatter associated with this handler is written out first.
        Specified by:
        publish in class Handler
        record - the log record to be logged.
      • isLoggable

        public boolean isLoggable(LogRecord record)
        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.

        isLoggable in class Handler
        record - the log record to be checked.
        true if record needs to be logged, false otherwise.


Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)





Java Script








Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 3010 / 159435503. Delta: 0.00266 с