static MeasurementFile readFromBundle(File bundlePath) throws Exception { Serializer serializer = new Persister(); MeasurementFile mc = serializer.read(MeasurementFile.class, new File(bundlePath, "data.xml")); for (MeasurementFrame f : mc.getMeasurementFrames()) { f.loadVideoFrameFromBundle(bundlePath); } return mc; }
void saveToBundle(File bundlePath) throws Exception { // if (bundlePath) if (!bundlePath.exists()) { bundlePath.mkdir(); } Serializer serializer = new Persister(); serializer.write(this, new File(bundlePath, "data.xml")); for (MeasurementFrame frame : getMeasurementFrames()) { ColorVideoFrame color = frame.getDualVideoFrame().getColorFrame(); DepthVideoFrame depth = frame.getDualVideoFrame().getDepthFrame(); String colorFilename = frame.id + ".color.png"; String depthFilename = frame.id + ".depth.bin"; color.write(new File(bundlePath, colorFilename)); depth.write(new File(bundlePath, depthFilename)); } }