开发者

JavaME FileConnection url

I want to save data to my Sony Ericsson K750i. I know the phone implements FileConnection version 1.0. The list of roots taken from

FileSystemRegistry.listRoots();

returns single element named "c:/". I want to save a file.txt just about anywhere, but preferably to the memory stick attached. Unfortunately, it doesn't seem to work. It throws an IOException without any message. I tried opening the fileconnection on numerous roots like c:/, C:/, /, ./, root1/, SDCard/, CFCard/, MemoryStick/ and perhaps some开发者_开发问答 more but without any luck.

The exception is thrown right after this line for any of those roots:

FileConnection filecon = (FileConnection) Connector.open("file:///MemoryStick/file.txt");

Please, what URL should i use?


I would suspect that your problem is that you are trying to write a file in a location your MIDlet isn't allowed to write to.

My guess is that you can read "c:/" just enough to figure out what its subfolders are. You can't create a file or a subfolder.

However, browse through c: subfolders and there should be a location somewhere where you can create a subfolder and/or a file.

Of course, all this assumes that your MIDlet is signed with a certificate that puts it in a security domain allowing good enough file system access.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜