Class StandardPacketInputStream
java.lang.Object
org.mariadb.jdbc.internal.io.input.StandardPacketInputStream
- All Implemented Interfaces:
PacketInputStream
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private final InputStreamprivate intprivate static final Loggerprivate static final intprivate final intprivate intprivate static final intprivate final byte[]private Stringprivate LruTraceCache -
Constructor Summary
ConstructorsConstructorDescriptionStandardPacketInputStream(InputStream in, Options options) Constructor of standard socket MySQL packet stream reader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()static byte[]create(byte[] value) Constructor for single Data (using text format).static byte[]create(byte[][] rowDatas, ColumnType[] columnTypes) Create Buffer with Text protocol values.intGet current input stream for creating compress input stream, to avoid losing already read bytes in case of pipelining.intgetPacket(boolean reUsable) byte[]getPacketArray(boolean reUsable) Get next packet.voidsetServerThreadId(long serverThreadId, Boolean isMaster) Set server thread id.voidsetTraceCache(LruTraceCache traceCache)
-
Field Details
-
REUSABLE_BUFFER_LENGTH
private static final int REUSABLE_BUFFER_LENGTH- See Also:
-
MAX_PACKET_SIZE
private static final int MAX_PACKET_SIZE- See Also:
-
logger
-
header
private final byte[] header -
reusableArray
private final byte[] reusableArray -
inputStream
-
maxQuerySizeToLog
private final int maxQuerySizeToLog -
packetSeq
private int packetSeq -
lastPacketLength
private int lastPacketLength -
serverThreadLog
-
traceCache
-
-
Constructor Details
-
StandardPacketInputStream
Constructor of standard socket MySQL packet stream reader.- Parameters:
in- streamoptions- connection options
-
-
Method Details
-
create
public static byte[] create(byte[] value) Constructor for single Data (using text format).- Parameters:
value- value- Returns:
- Buffer
-
create
Create Buffer with Text protocol values.- Parameters:
rowDatas- datascolumnTypes- column types- Returns:
- Buffer
-
getPacket
- Specified by:
getPacketin interfacePacketInputStream- Throws:
IOException
-
getInputStream
Get current input stream for creating compress input stream, to avoid losing already read bytes in case of pipelining.- Returns:
- input stream.
-
getPacketArray
Get next packet. If packet is more than 16M, read as many packet needed to finish packet. (first that has not length = 16Mb)- Specified by:
getPacketArrayin interfacePacketInputStream- Parameters:
reUsable- if can use existing reusable buffer to avoid creating array- Returns:
- array packet.
- Throws:
IOException- if socket exception occur.
-
getLastPacketSeq
public int getLastPacketSeq()- Specified by:
getLastPacketSeqin interfacePacketInputStream
-
getCompressLastPacketSeq
public int getCompressLastPacketSeq()- Specified by:
getCompressLastPacketSeqin interfacePacketInputStream
-
close
- Specified by:
closein interfacePacketInputStream- Throws:
IOException
-
setServerThreadId
Set server thread id.- Specified by:
setServerThreadIdin interfacePacketInputStream- Parameters:
serverThreadId- current server thread id.isMaster- is server master
-
setTraceCache
- Specified by:
setTraceCachein interfacePacketInputStream
-