Package org.jgrapes.io.util
Class CopyReader
java.lang.Object
java.io.Reader
java.io.FilterReader
org.jgrapes.io.util.CopyReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
A filter that copies all data read into a buffer.
The buffer has to be
cleared regularly (see copied
else heap space will eventually
become exhausted.
-
Field Summary
Fields inherited from class java.io.FilterReader
in
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopied()
Returns all chars and resets the copy buffer.int
read()
int
read
(char[] cbuf, int off, int len) setCopyBufferSize
(int size) Sets the copy buffer size, defaults to 10240.Methods inherited from class java.io.FilterReader
close, mark, markSupported, ready, reset, skip
Methods inherited from class java.io.Reader
nullReader, read, read, transferTo
-
Constructor Details
-
CopyReader
Instantiates a new copy reader.- Parameters:
source
- the source
-
-
Method Details
-
setCopyBufferSize
Sets the copy buffer size, defaults to 10240.- Parameters:
size
- the size- Returns:
- the copy reader
-
read
- Overrides:
read
in classFilterReader
- Throws:
IOException
-
read
- Overrides:
read
in classFilterReader
- Throws:
IOException
-
copied
Returns all chars and resets the copy buffer.- Returns:
- the string
-