Class TextFileBufferSnapshot

java.lang.Object
org.eclipse.handly.snapshot.Snapshot
org.eclipse.handly.snapshot.TextFileBufferSnapshot
All Implemented Interfaces:
ISnapshot

public final class TextFileBufferSnapshot extends Snapshot
A snapshot of an ITextFileBuffer. Thread-safe.
  • Constructor Details

    • TextFileBufferSnapshot

      public TextFileBufferSnapshot(org.eclipse.core.filebuffers.ITextFileBuffer buffer, org.eclipse.core.filebuffers.ITextFileBufferManager bufferManager)
      Constructs a new snapshot of the given text file buffer.
      Parameters:
      buffer - a buffer connected through the given buffer manager - must not be null and must be connected at least during the execution of this constructor
      bufferManager - must not be null
  • Method Details

    • getContents

      public 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 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