Hi to all!
At the moment I'm using the API that hasn't got FileConnection class,
so I'm using
OutputStream o = ((OutputConnection)Connector.open(
"file:///root1/file" )).openOutputStream();
I don't know if I have some typos, but it doesn't matter. It works for
files that already exist but there are several problems:
1. If the file doesn't exist, it won't create it. I saw thew way
people do it by using FileConnection, but I don't have it. What's the
way around?
2. If the file is bigger than the content I'm writing, only the part
of it is overwritten. What I would like is the "truncate" behaviour,
meaning the file should be truncated the moment it's open for writing.
3. How do I delete the file later, once I don't need it?
Thank you in advance, I'm waiting by the computer for the answer :)
[just kidding :]
Darko
Darko - 15 Nov 2006 16:59 GMT
Since noone has answered on my question, does anybody have an idea
where else should I put the question? Sun forum? Other Usenet group?
Somewhere else?
Thanks,
Darko
> Hi to all!
>
[quoted text clipped - 17 lines]
>
> Darko
Simon Brooke - 16 Nov 2006 19:42 GMT
> Since noone has answered on my question, does anybody have an idea
> where else should I put the question? Sun forum? Other Usenet group?
> Somewhere else?
Have patience, glasshopper. Answers will come.
In general in my experience this froup is /way/ better for J2ME questions
than any of the Sun or Nokia forums.

Signature
simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/
;; all in all you're just another click in the call
;; -- Minke Bouyed
ddimitrov - 15 Nov 2006 21:42 GMT
J2ME devices are not required to have a filesystem, hence - no standard
API. Some vendors offer custom connectors which kinda look like files
(check your vendor's docs.)
http://www.google.com/search?q=j2me%20connectors
The standard operational storage is the RMS:
http://www.google.com/search?q=j2me+rms
Any config files and images need to be loaded from the classpath or
downloaded from the server (AFAIR you can open a connection only to the
host from which the midlet was downloaded, but this may be an operator
restriction).
Simon Brooke - 16 Nov 2006 19:40 GMT
> Hi to all!
>
[quoted text clipped - 15 lines]
> Thank you in advance, I'm waiting by the computer for the answer :)
> [just kidding :]
MIDP doesn't mandate a file system; you cannot assume a file system exists
and you cannot in general write to one. If you /can/ write to something
using a 'file:///' URL I suggest that's a bug not a feature.
Personal Profile mandates a files system; if your device supports Personal
Profile you're OK. Otherwise, use RMS.

Signature
simon@jasmine.org.uk (Simon Brooke) http://www.jasmine.org.uk/~simon/
;; Friends don't send friends HTML formatted emails.
Darko - 17 Nov 2006 12:40 GMT
> 1. If the file doesn't exist, it won't create it. I saw thew way
> people do it by using FileConnection, but I don't have it. What's the
[quoted text clipped - 3 lines]
> meaning the file should be truncated the moment it's open for writing.
> 3. How do I delete the file later, once I don't need it?
Thanks to all, it's a good set of answers to show to my employer :)
He's convinced there's a way to do it, I was (after reading the midp
documentation) there isn't but I wondered if there's a way around.
Anyways, thank's a lot, it's obvious that, yes, I should have waited a
little bit more before getting impatient.
Bye,
Darko