The file extension and read per mission issue Hi, I am in the problem about reading data fr om some new file extensions, the problem is fis.read() gets -1 from the first run wit

by 100town » Sat, 24 Oct 2009 19:39:16 GMT


Sponsored Links
 Hi,

I am in the problem about reading data from some new file extensions,
the problem is fis.read() gets -1 from the first run without and
exceptions being thrown. Check the code below:
String path = sdcard/wanshuiqianshan.lrc
java.io.FileInputStream fis = null;
                try{
                        fis= new java.io.FileInputStream(path);
                        int c=0;
                        StringBuffer sb=new StringBuffer();
                        while(((c=fis.read())!=-1)){
                                sb.append((char)c);
                        }
                        Log.e("INFO", "Here 1;
                        return sb.toString();
                }catch(Exception ioe){
                        Log.e("EROOR", "file: "+path, ioe);
                        return null;
                }finally{
                        try{
                                fis.close();
                        }catch(Exception e){
                        }
                }
If I change the file extension to xt everything is all right. I
debugged into the android source then the code running into the native
C code so not any clue was found.

I searched in the group. Only some discuss leads to the cycle about
mime-type and file extensions which cannot help me.
I guess it is a build-in security mechanism about the undefined file
extension types. Can anybody help? Thanks.


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Needed reference to source code for adb shell command "input" that is used to inject keypresses.

Hi All,

The use case that I have to emulate is to inject random keypresses. I
have observed it that it is possible using adb shell command "input".
Can someone point me to the source code in the android build tree, so
that I can accordingly implement the same in our test app.

Regards,
Royston
QCOM

--~--~---------~--~----~------------~-------~--~----~

2. Is there a way to control the Android phone or do a automated test using a remote PC?

For a emulator,you can telnet localhost 5554 to send instructions.As
to a real device,I'm afraid you cann't do it this way;
Probably you'd have to run an agent written by yourself to acchive
this goal;Hope this helps!
BTW,I'm also working on android software testing.



--~--~---------~--~----~------------~-------~--~----~

3. "Enter" Key Virtual Keyboard

4. Motorola Android Devices Coming Sept. 10

5. hi, I'm the nre comer

6. Icon with label + background

7. ADC2 Question Updates