org.mariadb.jdbc.internal.io.input
Class StandardPacketInputStream

java.lang.Object
  extended by org.mariadb.jdbc.internal.io.input.StandardPacketInputStream
All Implemented Interfaces:
PacketInputStream

public class StandardPacketInputStream
extends Object
implements PacketInputStream


Constructor Summary
StandardPacketInputStream(InputStream in, int maxQuerySizeToLog)
           
 
Method Summary
 void close()
           
static byte[] create(byte[] value)
          Constructor for single Data (using text format).
static byte[] create(byte[][] rowData, ColumnType[] columnTypes)
          Create Buffer with Text protocol values.
 BufferedInputStream getBufferedInputStream()
          Get current Buffered input stream for creating compress input stream, to avoid losing already read bytes in case of pipelining.
 int getCompressLastPacketSeq()
           
 int getLastPacketLength()
           
 int getLastPacketSeq()
           
 Buffer getPacket(boolean reUsable)
           
 byte[] getPacketArray(boolean reUsable)
          Get next packet.
 void setServerThreadId(long serverThreadId, Boolean isMaster)
          Set server thread id.
 void setTraceCache(LruTraceCache traceCache)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardPacketInputStream

public StandardPacketInputStream(InputStream in,
                                 int maxQuerySizeToLog)
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[][] rowData,
                            ColumnType[] columnTypes)
Create Buffer with Text protocol values.

Parameters:
rowData - datas
columnTypes - column types
Returns:
Buffer

getPacket

public Buffer getPacket(boolean reUsable)
                 throws IOException
Specified by:
getPacket in interface PacketInputStream
Throws:
IOException

getBufferedInputStream

public BufferedInputStream getBufferedInputStream()
Get current Buffered input stream for creating compress input stream, to avoid losing already read bytes in case of pipelining.

Returns:
buffer input stream.

getPacketArray

public byte[] getPacketArray(boolean reUsable)
                      throws IOException
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:
getPacketArray in interface PacketInputStream
Parameters:
reUsable - if can use existing reusable buffer to avoid creating array
Returns:
array packet.
Throws:
IOException - if socket exception occur.

getLastPacketLength

public int getLastPacketLength()
Specified by:
getLastPacketLength in interface PacketInputStream

getLastPacketSeq

public int getLastPacketSeq()
Specified by:
getLastPacketSeq in interface PacketInputStream

getCompressLastPacketSeq

public int getCompressLastPacketSeq()
Specified by:
getCompressLastPacketSeq in interface PacketInputStream

close

public void close()
           throws IOException
Specified by:
close in interface PacketInputStream
Throws:
IOException

setServerThreadId

public void setServerThreadId(long serverThreadId,
                              Boolean isMaster)
Set server thread id.

Specified by:
setServerThreadId in interface PacketInputStream
Parameters:
serverThreadId - current server thread id.
isMaster - is server master

setTraceCache

public void setTraceCache(LruTraceCache traceCache)
Specified by:
setTraceCache in interface PacketInputStream


Copyright © 2017. All rights reserved.