|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.io.file.FileSystemJournal
public final class FileSystemJournal
This class represents a file system journal. The journal tracks changes to the file system and applications can query the entries. The journal has limited space so applications should be aware that not all changes are stored and that journal changes may be lost after a reset. For optimality, it is stressed that iteration be done backwards from the next USN to the cached value of the application or until a null journal entry is reached. An example of the code is provided below, which involves querying the journal and looking 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;
| Method Summary | ||
|---|---|---|
|
static FileSystemJournalEntry |
getEntry(long usn)
Retrieve a journal entry for corresponding USN. |
|
static long |
getNextUSN()
This method returns the next USN (Update Sequence Number) that the journal system will use. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static long getNextUSN()
public static FileSystemJournalEntry getEntry(long usn)
usn - The update sequence number of the entry to be retrieved.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.