@Override
    @SuppressWarnings("unchecked")
    public void read(JmeImporter im) throws IOException {
        InputCapsule in = im.getCapsule(this);

        controlPoints = in.readSavableArrayList("controlPoints", new ArrayList<>());
        /* Empty List as default, prevents null pointers */
        float list[] = in.readFloatArray("segmentsLength", null);
        if (list != null) {
            segmentsLength = new ArrayList<>(list.length);
            for (int i = 0; i < list.length; i++) {
                segmentsLength.add(list[i]);
            }
        }
        type = in.readEnum("type", SplineType.class, SplineType.CatmullRom);
        totalLength = in.readFloat("totalLength", 0);
        CRcontrolPoints = in.readSavableArrayList("CRControlPoints", null);
        curveTension = in.readFloat("curveTension", 0.5f);
        cycle = in.readBoolean("cycle", false);

        float[] knotArray = in.readFloatArray("knots", null);
        if (knotArray == null) {
            this.knots = null;
        } else {
            this.knots = new ArrayList<>(knotArray.length);
            for (float knot : knotArray) {
                knots.add(knot);
            }
        }

        weights = in.readFloatArray("weights", null);
        basisFunctionDegree = in.readInt("basisFunctionDegree", 0);
    }
De-serialize this spline from the specified importer, for example
when loading from a J3O file.

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