Modifier and Type | Class and Description |
---|---|
static class |
TextFileSnapshot.Layer
Specifies whether the snapshot is to be taken directly from the
file system, bypassing the workspace.
|
Constructor and Description |
---|
TextFileSnapshot(org.eclipse.core.resources.IFile file,
TextFileSnapshot.Layer layer)
Constructs a new snapshot of the given text
IFile . |
Modifier and Type | Method and Description |
---|---|
boolean |
exists()
Returns whether the file existed at the moment this snapshot was taken.
|
java.lang.String |
getContents()
A snapshot returns the same contents until it expires.
|
org.eclipse.core.runtime.IStatus |
getStatus()
Returns whether an I/O error was encountered while reading the file.
|
protected java.lang.Boolean |
predictEquality(Snapshot other)
|
public TextFileSnapshot(org.eclipse.core.resources.IFile file, TextFileSnapshot.Layer layer)
IFile
.
The workspace may be out of sync with the file system. The layer
argument controls how to deal with that. If Layer.FILESYSTEM
is specified, the snapshot will be taken directly from the file system,
bypassing the workspace. If Layer.WORKSPACE
is specified, the
snapshot will expire if the workspace is not in sync with the
corresponding location in the file system.
file
- not null
layer
- controls whether the snapshot is to be taken directly from
the file system, bypassing the workspacepublic java.lang.String getContents()
ISnapshot
null
.
Protractedly holding on the returned contents is not recommended, as it may potentially consume significant amount of space.
null
if
the snapshot has expiredpublic org.eclipse.core.runtime.IStatus getStatus()
public boolean exists()
true
if the file existed at the moment this snapshot
was taken, and false
otherwiseprotected java.lang.Boolean predictEquality(Snapshot other)
Snapshot
equal
without actually obtaining their contents
.
Must return null
if cannot tell for sure. Any non-null
result must meet the contract of ISnapshot.isEqualTo(ISnapshot)
.predictEquality
in class Snapshot
other
- the other snapshot (not null
and not identical to the receiver)true
if the two snapshots are predicted to be equal,
false
if the two snapshots are predicted to be unequal,
and null
if there is no predictionCopyright (c) 2014, 2019 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0