Package com.dtolabs.rundeck.core.utils
Class ThreadBoundLogOutputStream<D,T extends LogBuffer<D>>
- java.lang.Object
-
- java.io.OutputStream
-
- com.dtolabs.rundeck.core.utils.ThreadBoundLogOutputStream<D,T>
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
public class ThreadBoundLogOutputStream<D,T extends LogBuffer<D>> extends java.io.OutputStreamThread 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 voidclose()voidflush()voidflushBuffers()Flush all event buffers managed by the current managerLogBufferManager<D,T>installManager()Install a new inherited thread local buffer manager and return itjava.nio.charset.CharsetsetCharset(java.nio.charset.Charset charset)Set the charset to usevoidwrite(int b)Write output
-
-
-
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:
writein classjava.io.OutputStream- Parameters:
b-
-
flushBuffers
public void flushBuffers()
Flush all event buffers managed by the current manager
-
flush
public void flush()
- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
-