Class RedisInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.moilioncircle.redis.replicator.io.RedisInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class RedisInputStream extends InputStream
- Since:
- 2.1.0
- Author:
- Leon Chen
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bufprotected intheadprotected InputStreaminprotected booleanmarkprotected longmarkLenprotected List<RawByteListener>rawByteListenersprotected inttailprotected longtotal
-
Constructor Summary
Constructors Constructor Description RedisInputStream(ByteArray array)RedisInputStream(InputStream in)RedisInputStream(InputStream in, int len)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()intbufSize()voidclose()protected voidfill()inthead()booleanisMarked()voidmark()voidmark(long len)protected voidnotify(byte... bytes)intread()intread(byte[] b)intread(byte[] b, int off, int len)longread(ByteArray bytes, long offset, long len)ByteArrayreadBytes(long len)intreadInt(byte[] bytes)intreadInt(byte[] bytes, boolean littleEndian)intreadInt(int len)intreadInt(int length, boolean littleEndian)longreadLong(int len)longreadLong(int length, boolean littleEndian)StringreadString(int len)StringreadString(int len, Charset charset)longreadUInt(int length)longreadUInt(int length, boolean littleEndian)voidsetRawByteListeners(List<RawByteListener> rawByteListeners)longskip(long len)longskip(long len, boolean notify)inttail()longtotal()longunmark()-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, readAllBytes, readNBytes, readNBytes, reset, transferTo
-
-
-
-
Field Detail
-
head
protected int head
-
tail
protected int tail
-
total
protected long total
-
markLen
protected long markLen
-
buf
protected final byte[] buf
-
mark
protected boolean mark
-
in
protected final InputStream in
-
rawByteListeners
protected List<RawByteListener> rawByteListeners
-
-
Constructor Detail
-
RedisInputStream
public RedisInputStream(ByteArray array)
-
RedisInputStream
public RedisInputStream(InputStream in)
-
RedisInputStream
public RedisInputStream(InputStream in, int len)
-
-
Method Detail
-
setRawByteListeners
public void setRawByteListeners(List<RawByteListener> rawByteListeners)
- Parameters:
rawByteListeners- raw byte listeners- Since:
- 2.2.0
-
notify
protected void notify(byte... bytes)
-
head
public int head()
-
tail
public int tail()
-
bufSize
public int bufSize()
-
isMarked
public boolean isMarked()
-
mark
public void mark(long len)
-
mark
public void mark()
-
unmark
public long unmark()
-
total
public long total()
-
readBytes
public ByteArray readBytes(long len) throws IOException
- Throws:
IOException
-
readInt
public int readInt(int len) throws IOException- Throws:
IOException
-
readLong
public long readLong(int len) throws IOException- Throws:
IOException
-
readInt
public int readInt(int length, boolean littleEndian) throws IOException- Throws:
IOException
-
readUInt
public long readUInt(int length) throws IOException- Throws:
IOException
-
readUInt
public long readUInt(int length, boolean littleEndian) throws IOException- Throws:
IOException
-
readInt
public int readInt(byte[] bytes)
-
readInt
public int readInt(byte[] bytes, boolean littleEndian)
-
readLong
public long readLong(int length, boolean littleEndian) throws IOException- Throws:
IOException
-
readString
public String readString(int len) throws IOException
- Throws:
IOException
-
readString
public String readString(int len, Charset charset) throws IOException
- Throws:
IOException
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public long read(ByteArray bytes, long offset, long len) throws IOException
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
skip
public long skip(long len, boolean notify) throws IOException- Throws:
IOException
-
skip
public long skip(long len) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
fill
protected void fill() throws IOException- Throws:
IOException
-
-