private void sendFile(DataOutputStream out) throws IOException {
   Notifications.Bus.notify(
       new Notification(Constant.GROUND_ID, "GZIP", "Zip.......", NotificationType.INFORMATION));
   GZipFile.getInstance().gzipIt(path_plugins + "main.db", path_plugins + "main.db.zip");
   File myFile = new File(path_plugins + "main.db.zip");
   Notifications.Bus.notify(
       new Notification(
           Constant.GROUND_ID,
           "Action sendFile",
           "Begin send ..... - " + myFile.length(),
           NotificationType.INFORMATION));
   out.writeInt((int) myFile.length());
   byte[] buffer = new byte[Constant.BUFFER_SIZE];
   BufferedInputStream bis = new BufferedInputStream(new FileInputStream(myFile));
   int len;
   while ((len = bis.read(buffer)) > 0) {
     out.write(buffer, 0, len);
   }
   bis.close();
   out.close();
   Notifications.Bus.notify(
       new Notification(
           Constant.GROUND_ID,
           "Notification",
           "Send file successfully!",
           NotificationType.INFORMATION));
 }
 private void receiveFile(InputStream is, int fileSize) throws IOException {
   Notifications.Bus.notify(
       new Notification(
           Constant.GROUND_ID,
           "Action receiveFile",
           "Begin to receive file zip - " + fileSize,
           NotificationType.INFORMATION));
   int bytesRead;
   int byteCounts = 0;
   OutputStream output = new FileOutputStream(path_plugins + "main.db.zip");
   int sizeBuffer = Constant.BUFFER_SIZE;
   byte[] buffer = new byte[sizeBuffer];
   while ((bytesRead =
           is.read(buffer, 0, Math.max(sizeBuffer, Math.min(sizeBuffer, fileSize - byteCounts))))
       != -1) {
     output.write(buffer, 0, bytesRead);
     byteCounts += bytesRead;
     if (byteCounts >= fileSize) {
       break;
     }
   }
   output.close();
   Notifications.Bus.notify(
       new Notification(Constant.GROUND_ID, "GZIP", "Unzip.......", NotificationType.INFORMATION));
   GZipFile.getInstance().gunzipIt(path_plugins + "main.db.zip", path_plugins + "main.db");
   Notifications.Bus.notify(
       new Notification(
           Constant.GROUND_ID,
           "Notification",
           "Receive file successfully!",
           NotificationType.INFORMATION));
 }