if (zipData && packet.getData() != null) { out = new GZIPOutputStream(bos); zipped = true; } else { out = bos; } marshaller.marshall(packet, out); out.close(); byte[] data = bos.toByteArray(); sendNetworkPacket(data, zipped); bytesSent += data.length;
sendNetworkPacket(packet.getData(), packet.isCompressed());
    public synchronized void sendNow(Packet packet) {        boolean zipped = false;        ByteArrayOutputStream bos = new ByteArrayOutputStream();        OutputStream out;        try {            if (zipData && packet.getData() != null) {                out = new GZIPOutputStream(bos);                zipped = true;            } else {                out = bos;                                        }            marshaller.marshall(packet, out);            out.close();            byte[] data = bos.toByteArray();            sendNetworkPacket(data, zipped);            bytesSent += data.length;            debugLastFewCommandsSent.push(packet.getCommand());        } catch (Exception e) {            e.printStackTrace();        }    }