Package org.eclipse.handly.snapshot

## Class DocumentSnapshot

- java.lang.Object
- - org.eclipse.handly.snapshot.Snapshot
  - - org.eclipse.handly.snapshot.DocumentSnapshot

- All Implemented Interfaces:
    `ISnapshot`

      public final class DocumentSnapshot
      extends Snapshot

  A snapshot of an `IDocument`. Thread-safe.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DocumentSnapshot​(org.eclipse.jface.text.IDocument document)` | Constructs a new snapshot of the given document.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getContents()` | A snapshot returns the same contents until it expires.
    `protected java.lang.Boolean` | `predictEquality​(Snapshot other)` | Predicts whether this snapshot is `equal` to the given snapshot without actually obtaining snapshot `contents`.

    - ### Methods inherited from class org.eclipse.handly.snapshot.Snapshot

      `isEqualTo`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DocumentSnapshot

          public DocumentSnapshot​(org.eclipse.jface.text.IDocument document)

      Constructs a new snapshot of the given document.
      Parameters:
        `document` - must not be `null` and must implement `IDocumentExtension4`.

  - ### Method Detail

    - #### getContents

          public java.lang.String getContents()

      Description copied from interface: `ISnapshot`
      A 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 return `null`.

      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 `null` if the snapshot has expired

    - #### predictEquality

          protected java.lang.Boolean predictEquality​(Snapshot other)

      Description copied from class: `Snapshot`
      Predicts whether this snapshot is `equal` to the given snapshot without actually obtaining snapshot `contents`. Must return `null` if cannot tell for sure. Any non-null result must meet the contract of `ISnapshot.isEqualTo(ISnapshot)`.
      Overrides:
        `predictEquality` in class `Snapshot`
      Parameters:
        `other` - the other snapshot (not `null` and not identical to the receiver)
      Returns:
        `true` if the snapshots are predicted to be equal, `false` if the snapshots are predicted to be unequal, and `null` if there is no prediction