Class StandardPacketInputStream
- java.lang.Object
-
- org.mariadb.jdbc.internal.io.input.StandardPacketInputStream
-
- All Implemented Interfaces:
PacketInputStream
public class StandardPacketInputStream extends Object implements PacketInputStream
-
-
Constructor Summary
Constructors Constructor Description StandardPacketInputStream(InputStream in, Options options, long threadId)Constructor of standard socket MySQL packet stream reader.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static byte[]create(byte[] value)Constructor for single Data (using text format).static byte[]create(byte[][] row, ColumnType[] columnTypes)Create Buffer with Text protocol values.intgetCompressLastPacketSeq()InputStreamgetInputStream()Get current input stream for creating compress input stream, to avoid losing already read bytes in case of pipelining.intgetLastPacketSeq()BuffergetPacket(boolean reUsable)byte[]getPacketArray(boolean reUsable)Get next packet.voidsetServerThreadId(long serverThreadId, Boolean isMaster)Set server thread id.voidsetTraceCache(LruTraceCache traceCache)
-
-
-
Constructor Detail
-
StandardPacketInputStream
public StandardPacketInputStream(InputStream in, Options options, long threadId)
Constructor of standard socket MySQL packet stream reader.- Parameters:
in- streamoptions- connection optionsthreadId- thread id
-
-
Method Detail
-
create
public static byte[] create(byte[] value)
Constructor for single Data (using text format).- Parameters:
value- value- Returns:
- Buffer
-
create
public static byte[] create(byte[][] row, ColumnType[] columnTypes)Create Buffer with Text protocol values.- Parameters:
row- row datacolumnTypes- column types- Returns:
- Buffer
-
getPacket
public Buffer getPacket(boolean reUsable) throws IOException
- Specified by:
getPacketin interfacePacketInputStream- Throws:
IOException
-
getInputStream
public InputStream getInputStream()
Get current input stream for creating compress input stream, to avoid losing already read bytes in case of pipelining.- Specified by:
getInputStreamin interfacePacketInputStream- Returns:
- input stream.
-
getPacketArray
public byte[] getPacketArray(boolean reUsable) throws IOExceptionGet 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
public void close() throws IOException- Specified by:
closein interfacePacketInputStream- Throws:
IOException
-
setServerThreadId
public void setServerThreadId(long serverThreadId, Boolean isMaster)Set server thread id.- Specified by:
setServerThreadIdin interfacePacketInputStream- Parameters:
serverThreadId- current server thread id.isMaster- is server master
-
setTraceCache
public void setTraceCache(LruTraceCache traceCache)
- Specified by:
setTraceCachein interfacePacketInputStream
-
-