Half-commit. Not finished.
package horaris;
import javax.microedition.midlet.MIDlet;
import ogdl.Graph;
import ogdl.Ogdl2Graph;
import ogdl.OgdlParser;
import java.io.InputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.io.InputStreamReader;
import java.lang.Class;
public class File2Horaro
{
public static Horaro load(String filename, MIDlet main)
{
/* Open file */
InputStream is = main.getClass().getResourceAsStream(filename);
if (is == null)
{
System.err.println("Resource "+ filename +
" not found");
return null;
}
InputStreamReader in;
try {
in = new InputStreamReader(is,
"UTF-8");
} catch (UnsupportedEncodingException e) {
System.err.println("Enconding error " + e);
return null;
}
Horaro horaroevents = new Horaro();
try {
OgdlParser parser = new OgdlParser(in, horaroevents);
parser.parse();
} catch (Exception e) {
System.err.println("Exception parsing." + e.getMessage());
}
try {
in.close();
} catch (IOException e)
{
System.err.println("Exception closing is");
}
return horaroevents;
}
}