Class Configuration.LoggerWriter
java.lang.Object
java.io.Writer
org.noise_planet.noisemodelling.webserver.Configuration.LoggerWriter
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
- Enclosing class:
Configuration
A Writer implementation that redirects output to an SLF4J Logger instance.
This class is useful for redirecting output from a Writer to a logging framework.
It buffers the output and logs it when the buffer is flushed or closed.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionLoggerWriter(org.slf4j.Logger logger) Constructs a new LoggerWriter instance that redirects output to the specified Logger. -
Method Summary
-
Constructor Details
-
LoggerWriter
public LoggerWriter(org.slf4j.Logger logger) Constructs a new LoggerWriter instance that redirects output to the specified Logger.- Parameters:
logger- the SLF4J Logger instance to which output will be redirected
-
-
Method Details
-
write
Writes a portion of an array of characters to the buffer.- Specified by:
writein classWriter- Parameters:
cbuf- the array of characters to writeoff- the offset from which to start writinglen- the number of characters to write- Throws:
IOException- if an I/O error occurs
-
flush
Flushes the buffer and logs its contents to the Logger.- Specified by:
flushin interfaceFlushable- Specified by:
flushin classWriter- Throws:
IOException- if an I/O error occurs
-
close
Closes the Writer, but does not perform any actual closing operation.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException- if an I/O error occurs
-