JSR 75 (I)

25 April 2008

JSR 75 specifies 2 optional packages for mobile devices. I will be talking about these in the next few posts.

The two provided packages are:

javax.microedition.io.file
javax.microedition.pim

PIM stands for personal information and it contains following information:
- contact list
- todo list
- events

If you want to access these from a J2ME appliation, then javax.microedition.pim is to be used.

Mobile devices have a file system which contains files. You might be intereste din fetching those and playing with them. In that case, javax.microedition.io.file provides you with all the needed functionalities.

Interfaces:

FileConnection // Interface for access to files or directories.
FileSystemListener // Listener interface for receiving status notification when adding or removing a file-system root.

Classes:

FileSystemRegistry // Central registry for listeners that need to add or remove a file system.
ConnectionClosedException // Exception thrown when a method of a file connection is invoked but cannot be completed because the connection is closed.
IllegalModeException // Exception thrown when a method is invoked that requires a particular security mode, such as READ or WRITE, but the connection opened is not in that mode.

Let me present an example. I will create/open a file from the file system using FileConnection class of javax.microedition.io.file package.

public void createFile() {
   try {
      FileConnection filecon = (FileConnection)
         Connector.open("file:///SDCard/mynewfile.txt");
      // Always check whether the file or directory exists.
      // Create the file if it doesn't exist.
      if(!filecon.exists()) {
         filecon.create();
      }
      filecon.close();
   } catch(IOException ioe) {
   }
}

Related Posts:

  • No related posts
del.icio.us:JSR 75 (I)  digg:JSR 75 (I)  spurl:JSR 75 (I)  wists:JSR 75 (I)  simpy:JSR 75 (I)  newsvine:JSR 75 (I)  blinklist:JSR 75 (I)  furl:JSR 75 (I)  reddit:JSR 75 (I)  fark:JSR 75 (I)  blogmarks:JSR 75 (I)  Y!:JSR 75 (I)  smarking:JSR 75 (I)  magnolia:JSR 75 (I)  segnalo:JSR 75 (I)  gifttagging:JSR 75 (I)

Top Of Page | Trackback

If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.

It will look like this: JSR 75 (I)

Leave a Reply