How to open resource files in 6310i
I've previously developed an application that runs fine on Siemens' SL45. Now I'm trying to port it to 6310i but I can't understand how I can open a data input stream to a file that is located inside the jar.
In Siemens this works:
DataInputStream dis = Connector.openDataInputStream("resource:file.dat" ;
But this isn't the standard way, it should be "file://". I haven't tested this on Siemens but on 6310i none of these work:
I bet there is an easy answer but I can't find it in the documentation.
RE: How to open resource files in 6310i
This is the standard MIDP way, and it is fairly simple!
From an instance method:
InputStream in = getClass().getResourceAsStream("/file.dat" ;
Or static method:
InputStream in = new Object().getClass().getResourceAsStream("/file.dat" ;
DataInputStream din = new DataInputStream(in);
Hope this helps,