J2ME allow to delete contents of a file

jen

Joined
Mar 10, 2011
Messages
1
Reaction score
0
i just want to ask since i can read/write in fileconnection the contents of a file, is there a way to delete the contents of it also?

what i want is before i write to the file, i must clear it first so that that contents are all new..

what i've done is like this:
1) i open a file connection using:
FileConnection fconn = (FileConnection)Connector.open("file://localhost/" + currDirName + currFile, Connector.READ_WRITE);​

2) open the data output stream by:
DataOutputStream ops = fconn.openDataOutputStream();​

3) then write to the file the contents of writetocsv but before i write, i'll delete first:
ops.write(writetocsv);​

please help me thank you :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top