Modifying the contents of text file ini j2me

Hi,
I'm developing a application in j2me wherein i need to erase the previous stored contents fromthe text file and store new content submitted thru the front end program. Kindly please suggest me how to proceed in this regard.
Thanks

If you want to change an ini file in the jar file: you can't do that.
You can however store the changes in the RMS.

Similar Messages

  • How to get the content of text file to write in JTextArea?

    Hello,
    I have text area and File chooser..
    i wanna the content of choosed file to be written into text area..
    I have this code:
    import java.awt.Container;
    import java.awt.FlowLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.File;
    import javax.swing.JButton;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.*;
    public class Test_Stemmer extends JFrame {
    public Test_Stemmer() {
    super("Arabic Stemmer..");
    setSize(350, 470);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    setResizable(false);
    Container c = getContentPane();
    c.setLayout(new FlowLayout());
    JButton openButton = new JButton("Open");
    JButton saveButton = new JButton("Save");
    JButton dirButton = new JButton("Pick Dir");
    JTextArea ta=new JTextArea("File will be written here", 10, 25);
    JTextArea ta2=new JTextArea("Stemmed File will be written here", 10, 25);
    final JLabel statusbar =
                  new JLabel("Output of your selection will go here");
    // Create a file chooser that opens up as an Open dialog
    openButton.addActionListener(new ActionListener() {
       public void actionPerformed(ActionEvent ae) {
         JFileChooser chooser = new JFileChooser();
         chooser.setMultiSelectionEnabled(true);
         int option = chooser.showOpenDialog(Test_Stemmer.this);
         if (option == JFileChooser.APPROVE_OPTION) {
           File[] sf = chooser.getSelectedFiles();
           String filelist = "nothing";
           if (sf.length > 0) filelist = sf[0].getName();
           for (int i = 1; i < sf.length; i++) {
             filelist += ", " + sf.getName();
    statusbar.setText("You chose " + filelist);
    else {
    statusbar.setText("You canceled.");
    // Create a file chooser that opens up as a Save dialog
    saveButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    JFileChooser chooser = new JFileChooser();
    int option = chooser.showSaveDialog(Test_Stemmer.this);
    if (option == JFileChooser.APPROVE_OPTION) {
    statusbar.setText("You saved " + ((chooser.getSelectedFile()!=null)?
    chooser.getSelectedFile().getName():"nothing"));
    else {
    statusbar.setText("You canceled.");
    // Create a file chooser that allows you to pick a directory
    // rather than a file
    dirButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    JFileChooser chooser = new JFileChooser();
    chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    int option = chooser.showOpenDialog(Test_Stemmer.this);
    if (option == JFileChooser.APPROVE_OPTION) {
    statusbar.setText("You opened " + ((chooser.getSelectedFile()!=null)?
    chooser.getSelectedFile().getName():"nothing"));
    else {
    statusbar.setText("You canceled.");
    c.add(openButton);
    c.add(saveButton);
    c.add(dirButton);
    c.add(statusbar);
    c.add(ta);
    c.add(ta2);
    public static void main(String args[]) {
    Test_Stemmer sfc = new Test_Stemmer();
    sfc.setVisible(true);
    }could you please help me, and tell me what to add or to modify,,
    Thank you..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    realahmed8 wrote:
    thanks masijade,
    i have filter the file chooser for only text files,
    but i still don't know how to use FileReader to put text file content to the text area (ta) ..
    please tell me how and where to use it..How? -- See the IO Tutorials on Sun for the FileReader (and I assume you know how to call setText and append in the JTextArea).
    Where? -- In the actionPerformed method (better would be a separate thread that is triggered through the actionPerformed method, but that is probably beyond you at the moment), of course.
    Give it a try.

  • Is there any class that makes it possible to modify the content of a file?

    I am looking for a class in the APIs (preferably) that would make it possible to open up an existing file, and delete specific characters, insert characters at specific places and do things like that... Is there any such class?

    hmm, then would there be any way to reproduce the effect of the 'delete' or 'backspace' keys? If I'm right, I think there was an ASCII code for the backspace character... Would it be possible to insert it to get a character deleted!? :/
    I really need to find a way to do all of these operations on a text file because I think it wouldn't be a good idea to completely re-write 30Mb+ large files each time some data has to be modified :P

  • How to modify the content of a file

    Hello All,
    If anyone of you can help me in modifying the file conent.
    let's say for example, to modify the properties file.
    I've my.properties file with keys and values as follows.
    show=false
    secure=false
    test=false
    I would like to change the "false" value to "true" of any of the keys.
    java /jsp code would be helpful.
    appreciate your help in advance.

    OK..
    Break the problem down.
    You need to:
    1- Read the file into a String/String[]
    2- Parse the file into its individual elements
    3- change some of those elements
       This involves searching the string for the index of where a particular word or combination occurs, and then finding out the value that follows it, and then changing that value...
    4- re-construct the file
    5- write the fileDoes the format of the file have to be the way you've presented it above? (Personally, I'd use a pseudo-XML tag style)
    <productdisplay>true</productdisplay>
    <stockdisplay>false</stockdisplay>
    <addtobasket>true</addtobasket>~Dave

  • Updating the contents of a file fails

    Hi,
    I am trying to modify the contents of a file and then write the modifications back to the same file but I keep getting an empty file . What am I doing wrong here?
    import java.io.*;
    import java.lang.String;
    public class UpdateFile{
    public static void main( String args[]){
    try{
    BufferedReader in = new BufferedReader( new FileReader("SchedulerEvents.ini"));
    BufferedWriter out = new BufferedWriter( new FileWriter("SchedulerEvents.ini"));
    String str;
    String newString = null;
    while(( str = in.readLine()) != null){
                   newString = str.replaceAll("20030605", "20030507");
                   out.write( newString);
                   System.out.println( newString);
    in.close();
    out.close();
    } catch( IOException ioe){}

    Your trying to read and write to the same file at once. Just read everything into a string and open the output stream later in the program. This should work (I think):
    import java.io.*;
    import java.lang.String;
    public class UpdateFile{
    public static void main( String args[]){
    try{
    BufferedReader in = new BufferedReader( new FileReader("SchedulerEvents.ini"));
    String output = "";
    String str;
    String newString = null;
    while(( str = in.readLine()) != null){
    newString = str.replaceAll("20030605", "20030507");
    output = output + newString;
    System.out.println( newString);
    in.close();
    BufferedWriter out = new BufferedWriter( new FileWriter("SchedulerEvents.ini"));
    out.write( output);
    out.close();
    } catch( IOException ioe){}
    }

  • Passing contents of text file in oracle cursor

    Hi,
    I need to pass the content of text file in cursor and pass it on to calling codes. then calling codes will generate another text at their end. Can some help how can I pass contents of text file in oracle cursor? Thanks

    i need to do it without tables for some reasons.

  • How to save the RichTextBox Content in Text file

    hI ,
    I NEED TO SAVE THE RichTextBox Content in text file ? 

    If this IS a LabVIEW question, here's an example of how to load a rich text file (to help if you don't know how to get a rich text in LabVIEW).
    If you have a Rich Text Box, you can use the invoke method "SaveFile" to match the function you linked to.

  • How to save the contents of a file(not a text file)

    Hi all, I want to save the contents of a file(,png file, not a text file) as a field in a class. Shall I have it as a string or byte array or something?
    I have tried saving a file in a string but there were some problems with loading the file from a different platform. Following is my code.
            String string;
            try {
                StringBuffer sb = new StringBuffer(1024);
                char[] characterArray = new char[1024];
                BufferedReader br = new BufferedReader(new FileReader(file));
                while(br.read(characterArray) != -1){
                    sb.append(String.valueOf(characterArray));
                br.close();
                string= sb.toString();
            } catch (IOException ex) {
                ex.printStackTrace();
            }and I use the following code to recover the string back to a stream, and save that stream back to a time later.
        ByteArrayInputStream bais = new ByteArrayInputStream(map.getBytes());I realized that because this file is not a text file, the string could cause some problems. But anyone could tell me if I should use a byte array or someting? and how?
    Any help would be appreciated!
    Cheers,
    Jing

    You should use a byte array, and the binary streams (InputStream a& OutputStream). Never use Strings and Reader/Writer if you have binary data.
    Kaj

  • How to modify/replace the content server(UCM) file/image?

    Hi All,
    I want to modify the content/file of the Oracle UCM server. Do we have any Oracle UCM/IPM's webservice for this?
    For example, content server has a document/file which named as "a.doc". I want to replace this file with "b.doc" without altering any of the meta data.
    Kindly let me know if anybody have a solution for this.
    Thanks in advance!!
    Edited by: 902526 on Mar 20, 2012 1:58 PM
    Edited by: 902526 on Mar 20, 2012 2:02 PM

    Hi All,
    I want to modify the content/file of the Oracle UCM server. Do we have any Oracle UCM/IPM's webservice for this?
    For example, content server has a document/file which named as "a.doc". I want to replace this file with "b.doc" without altering any of the meta data.
    Kindly let me know if anybody have a solution for this.
    Thanks in advance!!
    Edited by: 902526 on Mar 20, 2012 1:58 PM
    Edited by: 902526 on Mar 20, 2012 2:02 PM

  • Weblogic-Modifying the content type

    Hi All,
    Is there a way to modify the content type in the Weblogic server.
    Basically what I want to do is, make IE6 to IE8 compatible for CSS3. I read somewhere that ".htaccess" file should be modified to make it work. I would like to add the below line...
    AddType text/x-component .htc
    So, where do I add this ?? Can some1 guide me as I dont know how to play around with WLS. I dont even know if there is such setting in WLS.
    WLS: 10g
    Thanks in advance..

    Tom and I exchanged several emails on this topic. It would appear that the problem (mail setting the content-type to ISO-2022-JP) is caused when certain characters in the quoted text of a reply are encoded; mail decides it needs to specify ISO-2022-JP. Characters identified as causing the problem are smart quotes and apostrophes. If you look at the apostrophe in the raw text it appears as =1B$B!G=1B(B and the smart quotes as =1B$B!H=1B(B and =1B$B!I=1B(B
    AK

  • How To Fetch the Content of a File from Client's PC?

    In my JSP I have this:
         <input type="file" name="filename">for visitors of the web page to browse their PCs' directories to select a file to upload (when the Submit button is clicked).
    What appears in the text field will be a file name. How do I get both the file name and the content of that file to be saved in the database?

    From http://www.htmlhelp.com/reference/html40/forms/input.html:
    A form that includes a file INPUT must specify METHOD=post and ENCTYPE="multipart/form-data" in the <FORM> tag. CGI libraries such as CGI.pm allow simple handling of such forms.
    Form-based file upload is unsupported by many currently deployed browsers. Authors should provide alternative methods of input where possible.
    The following example allows the user to upload an HTML document for validation:
    <FORM METHOD=post ACTION="/cgi-bin/validate.cgi" ENCTYPE="multipart/form-data">
    <P>Select an HTML document to upload and validate. If your browser does not support form-based file upload, use one of our alternate methods of validation.</P>
    <P><INPUT TYPE=file NAME="html_file" ACCEPT="text/html"></P>
    <P><INPUT TYPE=submit VALUE="Validate it!"></P>
    </FORM>
    Your servlet would then have to process whatever data is put into that parameter. You can look at O'Reilly's servlet utilities, or one of the other other links here:
    http://www.google.com/search?q=java+servlet+file+upload&sourceid=opera&num=0&ie=utf-8&oe=utf-8

  • How to store the contents of a file

    Hi,
    I'm using forms6i and database 10g.
    Through forms if a user selects a filename , and clicks a button or something,
    the contents of the file should be saved in the database.
    The file can be of any type, like .doc,.pdf,.xml,.html etc...
    and the contents filed will be of type varchar
    Please help me do this..
    Thanks

    Do you really want to save the "Content" of a file or the file itself? If you try to save the contents of a .doc or .pdf in a column with a VARCHAR2 datatype, you are going to corrupt the contents of the file since these file types have binary data in them as well as text. I think you would have greater success storing the actual file in a BLOB column.
    Here are a few Oracle Support documents that discuss how to store and retrieve files stored as BLOBs in the database.
    Doc ID: 168277.1 - How to Upload Binary Documents Back to Database BLOB Column from Forms
    Doc ID: 330146.1 - How to write BLOBs Stored Inside the Database Out to Files.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Reading the contents of a File without using the  fileref

    Hi ,
    I was trying to read the contents of a file (not upload
    basically) without using the fileref.upload or any servlets.
    I wanted to give this file as input(dataprovider) to a
    datagrid from the local instead of uploading it to the server and
    fetching the contents from there.
    I will explain the scenerio here:
    1.I have a text field. (Here I am providing the path of the
    file located).
    2.There is a Submit button .(On click should be able to take
    the specified file as input and read the contents of the file)
    which should be able to read the contents of the file path
    specified in step1.
    I want to basically provide the contents of this xml file as
    data provider to a datagrid.
    can anyone please provide some help on this issue.
    thanks

    You cannot access the local file system in Flex. You need to
    upload the file to the server, and then populate the file from that
    uploaded file. Unless of course you are using AIR, then this is
    doable.

  • Modifying a csv or text file

    Guys, does any of you know how to modify a csv or text file? Let's say I got a file containing the following line:
    "TV", "85 - <b>Black and White</b>", "Boston"
    Now let's say I wanna change the above line to the line below:
    Amout: 85 || Color: Black and White || Store Location: Boston
    Does anyone know how this can be done? I would really appreciate. Thanks a bunch.

    You can't modify a file unless the new data is the same size (number of characters, in your case) as the old data.
    Read the existing file and write a new file. Copy the old data, except substitute the new data for the old. Then rename the old file to something, rename the new file to the old name, and then delete the old renamed file.

  • Does Acrobat Pro read the content in pdf file and transforms it?

    Does Acrobat Pro read the content in pdf file and transforms it to xls file without the need for much changes or manual work?

    Acrobat X (Standard and Pro) will save tabular data to XLS or XLSX format, provided it can recognize the table as being a table. If the PDF has missing or incorrect structure tags, Acrobat will try to guess the table layout by the position of text and lines on the page - this works well for basic formatting but if the table has complex styling, spanned cells etc. it can lead to problems.
    Acrobat X will even attempt to export a table within a scanned document, by applying OCR during the export stage - though again this relies on the table being visually identified.
    See http://www.adobe.com/products/acrobatpro/pdf-to-word-excel-converter.html and this article on how to extract one table from a larger document.

Maybe you are looking for

  • PDP connection error when not on wi-fi

    This has probably been asked elsewhere so sorry in advance if it has!! Since leaving the house this morning (I use wifi at home) I've had "no network connection" even though I have full 3G signal! I've tried the hard reset & reset from the settings,

  • Found solution for connection problems iPod Nano 3rd gen to Windows Vista!!

    Hello people! I just found a solution to connection problems with iPod Nano 3rd generation when connecting it to a Windows Vista machine. Because of 'security reasons', Vista asks you to check the drive for errors when connecting the iPod. The thing

  • KM errors out on SP16 Java sneak preview

    Any ideas with this one? i have installed the full SP16 Java preview and all runs as expected, expect KM that is. Initially post install I had to change the repository manager path for /etc to my local sapmnt share. Now I can see into the /etc direct

  • Document missed in Inventory at the time of INIT

    Hello, In Inventory Cube 0IC_C03 we took INIT on 16.Oct.08 at approx 11:56 am. After a long time today we saw that Closing amount for a particular material is not matching with that of R/3. When analysed, we found that One material Document was poste

  • Why Java is slow?

    I am learning Java. I heard many people saying that Java is slow compared to other languages C,C++. What does that really mean?