In this sample, we:
create a MediaCollection on disk
add a pre-analyzed EDF file (perhaps made with the previous code sample, Analyzing a File)
close the collection.
// set
up the file names and locations
String
path="\\temp\\mymediacollection"
String edf = "\\temp\\mymediaobject"
// create
a MediaCollection object and a MediaObject
MediaCollection
mediaCollection = (MediaCollection) Eve.newMediaCollection();
MediaObject
mediaObject = (MediaObject) Eve.newMediaObject();
try
{
// create the collection on disk
mediaCollection.create (path);
// populate the MediaObject
mediaObject.loadFrom (edf);
// add the MediaObject to the collection
mediaCollection.add (mediaObject);
// close the collection
mediaCollection.close();
}
catch
(Exception e)
{
System.out.println("Error: " + e);
e.printStackTrace();
// always try to close the MediaCollection
try
{
mediaCollection.close();
}
catch (Exception ignore)
{
}
}
System.exit(0);