Top Description Fields Constructors Methods
org.springframework.util

public Class CommonsLogWriter

extends Writer
Class Inheritance
Imports
java.io.Writer, org.apache.commons.logging.Log

java.io.Writer adapter for a Commons Logging Log.
Author
Juergen Hoeller
Since
2.5.1

Field Summary

Modifier and TypeField and Description
private final StringBuilder
private final Log
Inherited from java.io.Writer:
lock

Constructor Summary

AccessConstructor and Description
public
CommonsLogWriter(Log
the Commons Logging logger to write to
logger
)

Create a new CommonsLogWriter for the given Commons Logging logger.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Closes the stream, flushing it first.
public void
flush()

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Flushes the stream.
public void
write(char ch)

public void
write(char[]
Array of characters
buffer
,
int
Offset from which to start writing characters
offset
,
int
Number of characters to write
length
)

Implements abstract java.io.Writer.write.

Writes a portion of an array of characters.
Inherited from java.io.Writer:
appendappendappendnullWriterwritewritewritewrite

Field Detail

bufferback to summary
private final StringBuilder buffer
loggerback to summary
private final Log logger

Constructor Detail

CommonsLogWriterback to summary
public CommonsLogWriter(Log logger)

Create a new CommonsLogWriter for the given Commons Logging logger.

Parameters
logger:Log

the Commons Logging logger to write to

Method Detail

closeback to summary
public void close()

Implements abstract java.io.Writer.close.

Implements java.io.Closeable.close.

Doc from java.io.Writer.close.

Closes the stream, flushing it first. Once the stream has been closed, further write() or flush() invocations will cause an IOException to be thrown. Closing a previously closed stream has no effect.

Annotations
@Override
flushback to summary
public void flush()

Implements abstract java.io.Writer.flush.

Implements java.io.Flushable.flush.

Doc from java.io.Writer.flush.

Flushes the stream. If the stream has saved any characters from the various write() methods in a buffer, write them immediately to their intended destination. Then, if that destination is another character or byte stream, flush it. Thus one flush() invocation will flush all the buffers in a chain of Writers and OutputStreams.

If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.

Annotations
@Override
writeback to summary
public void write(char ch)
writeback to summary
public void write(char[] buffer, int offset, int length)

Implements abstract java.io.Writer.write.

Doc from java.io.Writer.write.

Writes a portion of an array of characters.

Parameters
buffer:char[]

Array of characters

offset:int

Offset from which to start writing characters

length:int

Number of characters to write

Annotations
@Override