开发者

Text editor in J2ME - Store text in memory to edit

I'm developing a text editor in J2ME for editing source code, and because it has special features like syntax coloring, I can't use the regular TextBox, so I have to make a text box from scratch, using Canvas.

I found the way of reading/writing files from/to memory card, using FileConnection and the InputStreamReader/OutputStreamWriter classes for read and write text.

Now the problem 开发者_StackOverflow中文版is, when I read the file, how I can store the read information in memory, in order to edit the text freely and decide later if I can save or discard the changes?

Do I create a temporary file where I store the data for editing? But how can I write/delete text in middle of the file? Or do I have to dump the data in a StringBuffer?

Any methods or alternatives will be welcome.

Thanks!


I'd just use String (for storing the whole text in one variable)
or Vector of Strings (for storing the text line by line).

Temporary files is a very bad solution.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜