Package org.jsoup.internal
Class SimpleBufferedInput
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.jsoup.internal.SimpleBufferedInput
- All Implemented Interfaces:
Closeable,AutoCloseable
A simple implementation of a buffered input stream, in which we can control the byte[] buffer to recycle it. Not safe for
use between threads; no sync or locks. The buffer is borrowed on initial demand in fill.
- Since:
- 1.18.2
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final SoftPool<byte[]> (package private) static final intprivate intprivate intprivate intprivate byte[]private intprivate booleanFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint(package private) booleanCheck if the underlying InputStream has been read fully.(package private) voidcapRemaining(int newRemaining) (package private) voidvoidclose()private voidcompact()private voidfill()(package private) byte[]getBuf()intread()intread(byte[] dest, int offset, int desiredLen) (package private) void(package private) void(package private) voidsetMark()Methods inherited from class java.io.FilterInputStream
mark, markSupported, read, reset, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
BufferSize
static final int BufferSize- See Also:
-
BufferPool
-
capRemaining
private int capRemaining -
byteBuf
private byte[] byteBuf -
bufPos
private int bufPos -
bufLength
private int bufLength -
bufMark
private int bufMark -
inReadFully
private boolean inReadFully
-
-
Constructor Details
-
SimpleBufferedInput
SimpleBufferedInput(InputStream in)
-
-
Method Details
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
fill
- Throws:
IOException
-
getBuf
byte[] getBuf() -
baseReadFully
boolean baseReadFully()Check if the underlying InputStream has been read fully. There may still content in this buffer to be consumed.- Returns:
- true if the underlying inputstream has been read fully.
-
resetFullyRead
void resetFullyRead() -
available
- Overrides:
availablein classFilterInputStream- Throws:
IOException
-
capRemaining
void capRemaining(int newRemaining) -
setMark
void setMark() -
rewindToMark
- Throws:
IOException
-
clearMark
void clearMark() -
compact
private void compact() -
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-