Esempio n. 1
0
 public void write(OutputStream out) throws IOException {
   StreamUtil.writeUB3(out, getPacketLength());
   StreamUtil.write(out, packetId);
   StreamUtil.writeUB4(out, clientFlags);
   StreamUtil.writeUB4(out, maxPacketSize);
   StreamUtil.write(out, (byte) charsetIndex);
   out.write(FILLER);
   if (user == null) {
     StreamUtil.write(out, (byte) 0);
   } else {
     StreamUtil.writeWithNull(out, user.getBytes());
   }
   if (password == null) {
     StreamUtil.write(out, (byte) 0);
   } else {
     StreamUtil.writeWithLength(out, password);
   }
   if (database == null) {
     StreamUtil.write(out, (byte) 0);
   } else {
     StreamUtil.writeWithNull(out, database.getBytes());
   }
 }