Class AbstractAsyncInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.moilioncircle.redis.replicator.io.AbstractAsyncInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
AsyncBufferedInputStream,XPipedInputStream
public abstract class AbstractAsyncInputStream extends InputStream
- Since:
- 3.7.0
- Author:
- Jingqi Xu, andyqzb, Leon Chen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractAsyncInputStream.ByteRingBuffer
-
Field Summary
Fields Modifier and Type Field Description protected ConditionbufferNotEmptyprotected ConditionbufferNotFullprotected AtomicBooleanclosedprotected static intDEFAULT_CAPACITYprotected IOExceptionexceptionprotected ReentrantLocklockprotected org.slf4j.Loggerloggerprotected Closeableresourceprotected AbstractAsyncInputStream.ByteRingBufferringBuffer
-
Constructor Summary
Constructors Constructor Description AbstractAsyncInputStream(Closeable resource)AbstractAsyncInputStream(Closeable resource, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()intread()intread(byte[] b, int off, int len)intwrite(byte[] b, int off, int len)intwrite(int b)-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
DEFAULT_CAPACITY
protected static final int DEFAULT_CAPACITY
- See Also:
- Constant Field Values
-
resource
protected Closeable resource
-
exception
protected volatile IOException exception
-
ringBuffer
protected final AbstractAsyncInputStream.ByteRingBuffer ringBuffer
-
lock
protected final ReentrantLock lock
-
closed
protected final AtomicBoolean closed
-
bufferNotFull
protected final Condition bufferNotFull
-
bufferNotEmpty
protected final Condition bufferNotEmpty
-
-
Method Detail
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
write
public int write(int b) throws IOException- Throws:
IOException
-
write
public int write(byte[] b, int off, int len) throws IOException- Throws:
IOException
-
-