class DanmakuPacket {

    public byte[] generate() {
        byte[] bodyBytes = body.getBytes(UTF8);

        calculateLength(bodyBytes);

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(length);
        DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream);
        writeBigEndian(length, dataOutputStream);
        writeBigEndian(headerLength, dataOutputStream);
        writeBigEndian(protocolVersion, dataOutputStream);
        writeBigEndian(action.getID(), dataOutputStream);
        writeBigEndian(param, dataOutputStream);
        if (bodyBytes.length > 0) {
            byteArrayOutputStream.write(bodyBytes, 0, bodyBytes.length);
        }

        return byteArrayOutputStream.toByteArray();
    }

    public  DanmakuPacket(Action action);
    public  DanmakuPacket(Action action, String body);

}