Package redis.clients.jedis.util
Class RedisInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
redis.clients.jedis.util.RedisInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This class assumes (to some degree) that we are reading a RESP stream. As such it assumes certain
conventions regarding CRLF line termination. It also assumes that if the Protocol layer requires
a byte that if that byte is not there it is a stream error.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final byte[]protected intprivate static final intprotected intFields inherited from class java.io.FilterInputStream
in -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, reset, skipMethods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
INPUT_BUFFER_SIZE
private static final int INPUT_BUFFER_SIZE -
buf
protected final byte[] buf -
count
protected int count -
limit
protected int limit
-
-
Constructor Details
-
RedisInputStream
-
RedisInputStream
-
-
Method Details
-
readByte
- Throws:
JedisConnectionException
-
readLine
-
readLineBytes
public byte[] readLineBytes() -
readLineBytesSlowly
private byte[] readLineBytesSlowly()Slow path in case a line of bytes cannot be read in one #fill() operation. This is still faster than creating the StrinbBuilder, String, then encoding as byte[] in Protocol, then decoding back into a String. -
readIntCrLf
public int readIntCrLf() -
readLongCrLf
public long readLongCrLf() -
read
- Overrides:
readin classFilterInputStream- Throws:
JedisConnectionException
-
ensureFill
This methods assumes there are required bytes to be read. If we cannot read anymore bytes an exception is thrown to quickly ascertain that the stream was smaller than expected.- Throws:
JedisConnectionException
-