corelib.io.files.snapshots
Class DirectorySnapshot

java.lang.Object
  extended by corelib.io.files.snapshots.DirectorySnapshot

public class DirectorySnapshot
extends java.lang.Object

Create a directory snapshot. A directory snapshot contains informations about all files or subdirectories stored into the considered directory. The snapshot is saved into a text file. This class provides more traitments based on one or more snapshots.

Since:
0.3.7
Author:
Dominique Liard
See Also:
FileSystem.rmFromSnapshot(DirectorySnapshot)

Constructor Summary
DirectorySnapshot(java.lang.String directoryPath, java.lang.String snapshotFilename)
          Constructs a new directory snapshot.
 
Method Summary
 java.lang.String getCanonicalDirectoryPath()
          Returns the canonical path for the directory associated to this snapshot
 java.util.Iterator<java.io.File> getFilenames()
          Returns an iterator over the files stored in this directory snapshot, and in proper sequence.
static DirectorySnapshot loadFromFile(java.lang.String snapshotFilename)
          Reloading an existing snapshot from file.
 java.lang.String toString()
          Returns the string representation for this snapshot.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DirectorySnapshot

public DirectorySnapshot(java.lang.String directoryPath,
                         java.lang.String snapshotFilename)
                  throws DirectorySnapshotException
Constructs a new directory snapshot. The snapshot is saved into the specified snapshotFile.

Parameters:
directoryPath - The directory used for construct the snapshot.
snapshotFilename - The file used to save the snapshot content.
Throws:
DirectorySnapshotException - Thrown if the directory structure cannot be scan.
See Also:
FileSystem.rmFromSnapshot(DirectorySnapshot)
Method Detail

loadFromFile

public static DirectorySnapshot loadFromFile(java.lang.String snapshotFilename)
                                      throws DirectorySnapshotException
Reloading an existing snapshot from file. This loaded snapshot can be different from the actual structure of the associated directory.

Parameters:
snapshotFilename - The file used for reads snapshot data.
Returns:
The readed snapshot.
Throws:
DirectorySnapshotException - Thrown if the snapshot cannot be used.

getCanonicalDirectoryPath

public java.lang.String getCanonicalDirectoryPath()
Returns the canonical path for the directory associated to this snapshot

Returns:
The canonical path.

getFilenames

public java.util.Iterator<java.io.File> getFilenames()
                                              throws DirectorySnapshotException
Returns an iterator over the files stored in this directory snapshot, and in proper sequence.

Returns:
A new iterator instance.
Throws:
DirectorySnapshotException - Thrown if the snapshot cannot be used.

toString

public java.lang.String toString()
Returns the string representation for this snapshot. Caution: each call to this method produces a complete read of the associated file.

Overrides:
toString in class java.lang.Object
Returns:
The representative string.


CAUTION: Ellipse is proposed to you in BETA version to allow evaluation of this framework. Infini Software is released from any responsibility for the use of Ellipse Framework.

Copyright 2012 Infini Software - All Rights Reserved.