Package org.camunda.spin.impl.util
Class RewindableReader
java.lang.Object
java.io.Reader
org.camunda.spin.impl.util.RewindableReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Readable
Caches the initial characters that are read from the supplied
Reader
and
allows to rewind these. As soon as more than size
characters have been read,
rewinding fails.- Author:
- Thorben Lindhauer
-
Field Summary
Modifier and TypeFieldDescriptionprotected char[]
protected int
protected boolean
protected PushbackReader
-
Constructor Summary
-
Method Summary
Methods inherited from class java.io.Reader
nullReader, read, read, ready, transferTo
-
Field Details
-
wrappedReader
-
buffer
protected char[] buffer -
pos
protected int pos -
rewindable
protected boolean rewindable
-
-
Constructor Details
-
RewindableReader
-
-
Method Details
-
read
- Specified by:
read
in classReader
- Throws:
IOException
-
read
- Overrides:
read
in classReader
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-
mark
- Overrides:
mark
in classReader
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classReader
-
reset
- Overrides:
reset
in classReader
- Throws:
IOException
-
skip
- Overrides:
skip
in classReader
- Throws:
IOException
-
rewind
Rewinds the reader such that the initial characters are returned when invoking read(). Throws an exception if more than the buffering limit has already been read.- Throws:
IOException
-
getRewindBufferSize
public int getRewindBufferSize() -
getCurrentRewindableCapacity
public int getCurrentRewindableCapacity()- Returns:
- the number of characters that can still be read and rewound.
-