Class ThreadBoundLogOutputStream<D,​T extends LogBuffer<D>>

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class ThreadBoundLogOutputStream<D,​T extends LogBuffer<D>>
    extends java.io.OutputStream
    Thread local buffered log output
    • Constructor Summary

      Constructors 
      Constructor Description
      ThreadBoundLogOutputStream​(java.util.function.Consumer<D> logger, java.nio.charset.Charset charset, java.util.function.Function<java.nio.charset.Charset,​LogBufferManager<D,​T>> factory)
      Create a new thread local buffered stream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void flush()  
      void flushBuffers()
      Flush all event buffers managed by the current manager
      LogBufferManager<D,​T> installManager()
      Install a new inherited thread local buffer manager and return it
      java.nio.charset.Charset setCharset​(java.nio.charset.Charset charset)
      Set the charset to use
      void write​(int b)
      Write output
      • Methods inherited from class java.io.OutputStream

        nullOutputStream, write, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ThreadBoundLogOutputStream

        public ThreadBoundLogOutputStream​(java.util.function.Consumer<D> logger,
                                          java.nio.charset.Charset charset,
                                          java.util.function.Function<java.nio.charset.Charset,​LogBufferManager<D,​T>> factory)
        Create a new thread local buffered stream
        Parameters:
        logger - logger for events
    • Method Detail

      • setCharset

        public java.nio.charset.Charset setCharset​(java.nio.charset.Charset charset)
        Set the charset to use
        Parameters:
        charset - new charset
        Returns:
        previous charset
      • installManager

        public LogBufferManager<D,​T> installManager()
        Install a new inherited thread local buffer manager and return it
        Returns:
        manager
      • write

        public void write​(int b)
        Write output
        Specified by:
        write in class java.io.OutputStream
        Parameters:
        b -
      • flushBuffers

        public void flushBuffers()
        Flush all event buffers managed by the current manager
      • flush

        public void flush()
        Specified by:
        flush in interface java.io.Flushable
        Overrides:
        flush in class java.io.OutputStream
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.OutputStream
        Throws:
        java.io.IOException