×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    closing FileConnection

    In the book I read, it said that “You should immediately call close() on the FileConnection after a delete(). The FileConnection is no longer valid once the underlying file has been deleted”
    But in my program, although I have done deletion, I can still use the instance of reference to the FileConnection.
    Why?
    Code:
    fileconnection=(FileConnection) Connector.open("file:///root1/createfile.PNG",Connector.READ_WRITE);
    			fileconnection.create();
    			fileconnection.delete();
    			System.out.println(fileconnection.usedSize());
    			fileconnection.create();
    
    /////////////////////////it rename file but give error
    fileconnection.rename(“rename.png”);

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

    Re: closing FileConnection

    After calling delete() if create() is called it will creates a new file, but if you try to rename after delete it gives error because no physical file is present to rename.
    Thanks,
    Ekta

Similar Threads

  1. FileConnection
    By dakz in forum Mobile Java General
    Replies: 17
    Last Post: 2008-11-29, 08:38
  2. FileConnection not available
    By stein in forum Mobile Java General
    Replies: 11
    Last Post: 2007-09-05, 06:30
  3. FileConnection
    By martinmydlar in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2007-02-05, 00:08
  4. help regarding Fileconnection
    By mottaisami in forum Mobile Java General
    Replies: 0
    Last Post: 2005-10-22, 06:24
  5. Fileconnection
    By lpinguin in forum Mobile Java General
    Replies: 0
    Last Post: 2005-05-10, 15:31

Posting Permissions

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