Package org.apache.commons.io.input
Class UnsynchronizedReader
java.lang.Object
java.io.Reader
org.apache.commons.io.input.UnsynchronizedReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
- Direct Known Subclasses:
UnsynchronizedBufferedReader
A
Reader without any of the superclass' synchronization.- Since:
- 2.17.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanWhetherclose()completed successfully.private static final intThe maximum skip-buffer size.private char[]The skip buffer, defaults to null until allocated inskip(long). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidChecks if this instance is closed and throws an IOException if so.voidclose()booleanisClosed()Tests whether this instance is closed; ifclose()completed successfully.voidsetClosed(boolean closed) Sets whether this instance is closed.longskip(long n) Skips characters by reading from this instance.
-
Field Details
-
MAX_SKIP_BUFFER_SIZE
private static final int MAX_SKIP_BUFFER_SIZEThe maximum skip-buffer size.- See Also:
-
closed
private boolean closedWhetherclose()completed successfully. -
skipBuffer
private char[] skipBufferThe skip buffer, defaults to null until allocated inskip(long).
-
-
Constructor Details
-
UnsynchronizedReader
public UnsynchronizedReader()
-
-
Method Details
-
checkOpen
Checks if this instance is closed and throws an IOException if so.- Throws:
IOException- if this instance is closed.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-
isClosed
public boolean isClosed()Tests whether this instance is closed; ifclose()completed successfully.- Returns:
- whether this instance is closed.
-
setClosed
public void setClosed(boolean closed) Sets whether this instance is closed.- Parameters:
closed- whether this instance is closed.
-
skip
Skips characters by reading from this instance. This method will block until:- some characters are available,
- an I/O error occurs, or
- the end of the stream is reached.
- Overrides:
skipin classReader- Parameters:
n- The number of characters to skip.- Returns:
- The number of characters actually skipped.
- Throws:
IllegalArgumentException- Ifnis negative.IOException- If an I/O error occurs.
-