Package org.zkoss.io

Class RepeatableReader

java.lang.Object
java.io.Reader
org.zkoss.io.RepeatableReader
All Implemented Interfaces:
Closeable, Serializable, AutoCloseable, Readable, Repeatable

public class RepeatableReader extends Reader implements Repeatable, Serializable
RepeatableReader adds functionality to another reader, the ability to read repeatedly. By repeatable-read we mean, after close(), the next invocation of read(char[], int, int) will re-open the reader.

RepeatableInputStream actually creates a temporary space to buffer the content, so it can be re-opened again after closed. Notice that the temporary space (a.k.a., the buffered reader) is never closed until garbage-collected.

If the content size of the given reader is smaller than the value specified in the system property called "org.zkoss.io.memoryLimitSize", the content will be buffered in the memory. If the size exceeds, the content will be buffered in a temporary file. By default, it is 512KB. Note: the maximal value is Integer.MAX_VALUE

If the content size of the given reader is larger than the value specified in the system property called "org.zkoss.io.bufferLimitSize", the content won't be buffered, and it means the read is not repeatable. By default, it is 20MB. Note: the maximal value is Integer.MAX_VALUE

Since:
3.0.4
Author:
tomyeh
See Also: