Hello, everyone
I am trying to read data from resource files with Class.getResourceAsStream(), and I get some problems.
It seems related to file extensions.
It works well with .png and .mid, but failed when i use .txt, .dat and some other extensions defined by myself.
I am using JBuilder 7, MobileSet 3.0 and Nokia 7210 MIDP SDK 1.0, and here is the involved code segment:
---------------------------------------------------------------------------------
?_?_?_?_
>1 InputStream is = getClass().getResourceAsStream("/data.png");
>2 if(is == null) return ;
>3 DataInputStream dis = new DataInputStream(is) ;
// and then some code to read data from dis
---------------------------------------------------------------------------------
When I change the file name "/data.png" to "/data.db" for example, it doesn't work.
I've studied some examples and searched on this forum for this problem. And extensions other then .png and .mid do work fine.
Does JBuilder make any differents?
Any suggestion will be helpful.
Thanks
Steven


Reply With Quote


