net.rim.device.api.io.file
Class FileSystemJournal

java.lang.Object
  extended by net.rim.device.api.io.file.FileSystemJournal

public final class FileSystemJournal
extends Object

This class represents a file system journal. The journal tracks changes to the file system. Applications can query the entries. The journal has limited space, so not all changes are stored. Also, journal changes may be lost after a reset. For optimality, iteration should be done backwards from the next Update Sequence Number (USN) to the cached value of the application, or until a null journal entry is reached. Here is an example that queries the journal for a previously-added file with the name mindwave:

  long nextUSN = FileSystemJournal.getNextUSN();
  for (long lookUSN = nextUSN-1; lookUSN >= _myStoredUSN; lookUSN--) {
     FileSystemJournalEntry entry = FileSystemJournal.getEntry(lookUSN);
      
     if (entry == null) {
          // We didn't find an entry.
          break;
      }
      
      if (entry.getEvent() == FileSystemJournalEntry.FILE_ADDED) {
          String path = entry.getPath();
          if (path != null && path.indexOf("mindwave") != -1) {
              System.out.println("Found a file added named mindwave");
              break;
          }
      }
  }
  _myStoredUSN = nextUSN;
 
  

Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.2.0

Method Summary
Category: Signed static FileSystemJournalEntry getEntry(long usn)
          Returns a journal entry for the corresponding Update Sequence Number (USN).
Category: Signed static long getNextUSN()
          Returns the next Update Sequence Number (USN) that the journal system will use.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Method Detail

getNextUSN

public static long getNextUSN()
Returns the next Update Sequence Number (USN) that the journal system will use.

Returns:
The next USN to be used.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.2.0

getEntry

public static FileSystemJournalEntry getEntry(long usn)
Returns a journal entry for the corresponding Update Sequence Number (USN). This method returns null if the update sequence number is out of range of the current stored values. It is recommended that once an application retrieves a null journal entry, iteration should stop.

Parameters:
usn - The USN of the entry to be retrieved.
Returns:
The corresponding USN; or null if the USN is out of range of current stored values.
Category:
Signed: This element is only accessible by signed applications. If you intend to use this element, please visit http://www.blackberry.com/go/codesigning to obtain a set of code signing keys. Code signing is only required for applications running on BlackBerry smartphones; development on BlackBerry Smartphone Simulators can occur without code signing.
Since:
BlackBerry API 4.2.0





Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal