开发者

J2ME Writing in CSV file through file Connection API

I am creating an application in which i need to add a new column in the csv file and then entries for that particular column.

And I have tried OutputStream and PrintStream but the problem is that the 开发者_开发技巧data is being written in starting of the file but i want the data at random position according to my need. And RandomAccessFile is not identified by the application.

For e.g.

My CSV is:

Name,any_date

A,

B,

c,

And after writing it will look like

Name,any_date

A,p

B,a

C,p

I am using file Connection API to read and write.Can anyone suggest me how to do that?? Thanks in advance.


i think you want to append data in the file.

you can try this

 os = fconn.openOutputStream(fconn.fileSize());  
        os.write(data.getBytes()); 

This is a simple example to append data at last.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜