Package org.eclipse.handly.snapshot
Class TextFileStoreSnapshot
- java.lang.Object
-
- org.eclipse.handly.snapshot.Snapshot
-
- org.eclipse.handly.snapshot.TextFileStoreSnapshot
-
-
Constructor Summary
Constructors Constructor Description TextFileStoreSnapshot(org.eclipse.core.filesystem.IFileStore fileStore)Constructs a new snapshot of the given text file store.TextFileStoreSnapshot(org.eclipse.core.filesystem.IFileStore fileStore, java.nio.charset.Charset charset)Constructs a new snapshot of the given text file store using the given charset for decoding the file store's contents.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexists()Returns whether the file existed at the moment this snapshot was taken.java.lang.StringgetContents()A snapshot returns the same contents until it expires.org.eclipse.core.runtime.IStatusgetStatus()Returns whether an I/O error was encountered while reading the file.protected java.lang.BooleanpredictEquality(Snapshot other)
-
-
-
Constructor Detail
-
TextFileStoreSnapshot
public TextFileStoreSnapshot(org.eclipse.core.filesystem.IFileStore fileStore)
Constructs a new snapshot of the given text file store. The snapshot may use a default charset for decoding the file store's contents if a more specific charset could not be detected for the file store.- Parameters:
fileStore- must not benull
-
TextFileStoreSnapshot
public TextFileStoreSnapshot(org.eclipse.core.filesystem.IFileStore fileStore, java.nio.charset.Charset charset)Constructs a new snapshot of the given text file store using the given charset for decoding the file store's contents.- Parameters:
fileStore- must not benullcharset- must not benull
-
-
Method Detail
-
getContents
public java.lang.String getContents()
Description copied from interface:ISnapshotA snapshot returns the same contents until it expires. This is the contents of the underlying resource or buffer at the moment the snapshot was taken. Expired snapshots returnnull.Protractedly holding on to the returned contents is not recommended, as it may potentially consume significant amount of space.
- Returns:
- the contents of the snapshot, or
nullif the snapshot has expired
-
getStatus
public org.eclipse.core.runtime.IStatus getStatus()
Returns whether an I/O error was encountered while reading the file.- Returns:
- an error status if an I/O error was encountered, or OK status otherwise
-
exists
public boolean exists()
Returns whether the file existed at the moment this snapshot was taken.- Returns:
trueif the file existed at the moment this snapshot was taken, andfalseotherwise
-
predictEquality
protected java.lang.Boolean predictEquality(Snapshot other)
Description copied from class:SnapshotPredicts whether this snapshot isequalto the given snapshot without actually obtaining snapshotcontents. Must returnnullif cannot tell for sure. Any non-null result must meet the contract ofISnapshot.isEqualTo(ISnapshot).- Overrides:
predictEqualityin classSnapshot- Parameters:
other- the other snapshot (notnulland not identical to the receiver)- Returns:
trueif the snapshots are predicted to be equal,falseif the snapshots are predicted to be unequal, andnullif there is no prediction
-
-