×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    6

    how to write at the end of a text file in Nokia 5233 in j2me

    Hi friends,

    I am trying to write to a file in j2me through file connection api.
    The issue i am facing is,i am able to create a file and can write the text in it.
    But next time when i try to append the data at the end of file,nothing happens.

    Code;

    FileConnection fc=(FileConnection)Connector.open(filename,Connector.Read_Write);
    if(!(fc.exists)
    {
    fc.create();
    fc.openOutputStream();
    }
    else
    fc.openOutputStream(Long.MAX_VALUE);
    os.write(data);
    os.flush();
    os.close();

    Now the issue is,when i run the midlet and it does not find the file,it creates it and adds the text to it.
    But next time,when this file exists,it does nothing.

    Can anyone tell its solution to me.

    i am using nokia 5233
    I have added the permissions to it in jad file.

  2. #2
    Registered User
    Join Date
    Jun 2010
    Posts
    6

    Re: how to write at the end of a text file in Nokia 5233 in j2me

    And this code runs fine in sdk 3.0 emulator. it appends the data at the end of the file.

  3. #3
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: how to write at the end of a text file in Nokia 5233 in j2me

    Hello vipul.gupta,

    and welcome to Forum Nokia Discussion Boards!

    What happens if instead of

    fc.openOutputStream(Long.MAX_VALUE);

    you use just

    fc.openOutputStream();

    ?

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  4. #4
    Registered User
    Join Date
    Jun 2010
    Posts
    6

    Re: how to write at the end of a text file in Nokia 5233 in j2me

    hi r2j7,

    if i use fc.openOutputStream(), it overwrites the existing data in file instead of appending data at the end of it.
    it seems to be that the security model of the is not allowing my application to modify the data of file.
    plz help me,its very urgent

  5. #5
    Registered User
    Join Date
    Jun 2010
    Posts
    6

    Re: how to write at the end of a text file in Nokia 5233 in j2me

    Hello friends,

    Now somehow i am able to discover that when i try to overwrite the file, my application throws unexpected ioexception.
    But unfortunately not able to discover the reason the reason for it.
    Can some help me?

    This is an issue with Nokia 5233

  6. #6
    Registered User
    Join Date
    Jun 2010
    Posts
    6

    Re: how to write at the end of a text file in Nokia 5233 in j2me

    hey its sorted now.
    its working.

  7. #7
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: how to write at the end of a text file in Nokia 5233 in j2me

    Quote Originally Posted by vipul.gupta View Post
    hey its sorted now.
    its working.
    How, you signed your application?
    Thanks,
    Ekta

Similar Threads

  1. About Write Text File In J2me
    By abhi4u in forum Mobile Java General
    Replies: 11
    Last Post: 2012-09-26, 05:44
  2. How to write into a text file in J2ME?
    By junedahmed in forum Mobile Java General
    Replies: 2
    Last Post: 2010-04-22, 11:40
  3. very simple middlet class to write to write a text file
    By a_sina_a in forum Mobile Java General
    Replies: 10
    Last Post: 2008-03-07, 16:35
  4. how to write in a text file using J2me
    By b7b7 in forum Mobile Java Tools & SDKs
    Replies: 2
    Last Post: 2007-07-01, 11:36
  5. Replies: 3
    Last Post: 2004-02-29, 14:47

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×