public void read(BinaryPacket bin) {
   packetLength = bin.packetLength;
   packetId = bin.packetId;
   MySQLMessage mm = new MySQLMessage(bin.data);
   protocolVersion = mm.read();
   serverVersion = mm.readBytesWithNull();
   threadId = mm.readUB4();
   seed = mm.readBytesWithNull();
   serverCapabilities = mm.readUB2();
   serverCharsetIndex = mm.read();
   serverStatus = mm.readUB2();
   mm.move(13);
   restOfScrambleBuff = mm.readBytesWithNull();
 }
 public void read(byte[] data) {
   MySQLMessage mm = new MySQLMessage(data);
   packetLength = mm.readUB3();
   packetId = mm.read();
   protocolVersion = mm.read();
   serverVersion = mm.readBytesWithNull();
   threadId = mm.readUB4();
   seed = mm.readBytesWithNull();
   serverCapabilities = mm.readUB2();
   serverCharsetIndex = mm.read();
   serverStatus = mm.readUB2();
   mm.move(13);
   restOfScrambleBuff = mm.readBytesWithNull();
 }
Exemple #3
0
 public void read(byte[] data) {
   MySQLMessage mm = new MySQLMessage(data);
   packetLength = mm.readUB3();
   packetId = mm.read();
   clientFlags = mm.readUB4();
   maxPacketSize = mm.readUB4();
   charsetIndex = (mm.read() & 0xff);
   // read extra
   int current = mm.position();
   int len = (int) mm.readLength();
   if (len > 0 && len < FILLER.length) {
     byte[] ab = new byte[len];
     System.arraycopy(mm.bytes(), mm.position(), ab, 0, len);
     this.extra = ab;
   }
   mm.position(current + FILLER.length);
   user = mm.readStringWithNull();
   password = mm.readBytesWithLength();
   if (((clientFlags & Capabilities.CLIENT_CONNECT_WITH_DB) != 0) && mm.hasRemaining()) {
     database = mm.readStringWithNull();
   }
 }