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
FieldsModifier and TypeFieldDescriptionprotected char[]protected intprotected booleanprotected PushbackReader -
Constructor Summary
Constructors -
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:
readin classReader- Throws:
IOException
-
read
- Overrides:
readin classReader- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
mark
- Overrides:
markin classReader- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classReader
-
reset
- Overrides:
resetin classReader- Throws:
IOException
-
skip
- Overrides:
skipin 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.
-