|
|||||||||
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.
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;
Method Summary | ||
---|---|---|
|
static FileSystemJournalEntry |
getEntry(long usn)
Returns a journal entry for the corresponding Update Sequence Number (USN). |
|
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 |
---|
public static long getNextUSN()
public static FileSystemJournalEntry getEntry(long usn)
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.
usn
- The USN of the entry to be retrieved.
null
if the USN is out of range of current stored values.
|
|||||||||
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.