×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    23

    file connection api (append question)

    Hi

    Is there an easy way to append strings at the end of a file?

    I saw somewhere "filename.txt;append=true" as file name but i cant believe that would work... (tested it too)

    Your help will be apreciated

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: file connection api (append question)

    Use fileSize() to get the size of the file.

    Then when you want to write to it, use openOutputStream() with an argument that sets the offset to the end of the file (size of the file) and start writing.

    If you set the parameter (offset) to the maximum value of a long, then you don't need to get the size/length of the file. The SDK docs for JSR-75 and this method says: "If the provided offset is larger than or equal to the current file size, the OutputStream is positioned at the current end of the file for appending."

  3. #3
    Registered User
    Join Date
    Mar 2008
    Posts
    23

    Re: file connection api (append question)

    Quote Originally Posted by petrib View Post
    Then when you want to write to it, use openOutputStream() with an argument that sets the offset to the end of the file (size of the file) and start writing.

    and how can i put the offset parameter in the openOutputStream()??

    like this??:
    Code:
    openOutputStream(offset)

  4. #4
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: file connection api (append question)

    FileConnection connection = ()Connector.open(url,Connector.write);
    OutputStream stream = connection.openOutputStream(long byteOffset) ;
    stream.write(byte[]);
    stream.flush();
    stream.close();
    connection.close();
    stream = null;
    connection = null;

    check and reply..
    thanks,
    jitu_goldie..

    KEEP TRYING..

Similar Threads

  1. Regarding BMCONV
    By sanah007 in forum Symbian
    Replies: 2
    Last Post: 2009-05-26, 12:47
  2. Error with makesis.exe and creating the .pkg file
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-10-10, 13:53
  3. Contacts fields order??
    By timatima in forum Symbian
    Replies: 1
    Last Post: 2007-06-08, 13:51
  4. Code Signing Certificates with File Connection Api
    By Rozik in forum Mobile Java General
    Replies: 1
    Last Post: 2007-05-30, 22:26
  5. file connection api vs signing
    By Rozik in forum Mobile Java General
    Replies: 1
    Last Post: 2007-05-15, 19:52

Posting Permissions

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