@Override
    public void write(JmeExporter ex) throws IOException {
        OutputCapsule oc = ex.getCapsule(this);
        oc.writeSavableArrayList((ArrayList) controlPoints, "controlPoints", null);
        oc.write(type, "type", SplineType.CatmullRom);

        float list[] = null;
        if (segmentsLength != null) {
            list = new float[segmentsLength.size()];
            for (int i = 0; i < segmentsLength.size(); i++) {
                list[i] = segmentsLength.get(i);
            }
        }
        oc.write(list, "segmentsLength", null);

        oc.write(totalLength, "totalLength", 0);
        oc.writeSavableArrayList((ArrayList) CRcontrolPoints, "CRControlPoints", null);
        oc.write(curveTension, "curveTension", 0.5f);
        oc.write(cycle, "cycle", false);

        float[] knotArray;
        if (knots == null) {
            knotArray = null;
        } else {
            knotArray = new float[knots.size()];
            for (int i = 0; i < knotArray.length; ++i) {
                knotArray[i] = knots.get(i);
            }
        }
        oc.write(knotArray, "knots", null);

        oc.write(weights, "weights", null);
        oc.write(basisFunctionDegree, "basisFunctionDegree", 0);
    }
Serialize this spline to the specified exporter, for example when
saving to a J3O file.

@param ex (not null)
@throws IOException from the exporter
jme3-core/src/main/java/com/jme3/math/Spline.java