Interface ISnapshotProvider
- All Superinterfaces:
AutoCloseable,IReferenceCountable
- All Known Subinterfaces:
IBuffer
- All Known Implementing Classes:
Buffer,ChildBuffer,TextEditorBuffer,TextFileBuffer
Snapshot providers support IReferenceCountable protocol, although
some implementations do not have a need in reference counting and inherit
a no-op implementation of the protocol methods in this interface. When it
is known that a snapshot provider does not actually use reference counting,
clients do not need to follow the requirements set forth in that protocol.
Snapshot providers are generally designed to be safe for use by multiple threads. Each implementation is expected to clearly document thread-safety guarantees it provides.
-
Method Summary
Methods inherited from interface org.eclipse.handly.util.IReferenceCountable
close
-
Method Details
-
getSnapshot
ISnapshot getSnapshot()Returns the current snapshot of the underlying resource or buffer. The returned snapshot may immediately become stale or expire.Note that it is possible to obtain a
non-expiringsnapshot from the provider, although protractedly holding on non-expiring snapshots is not recommended as they may potentially consume large amount of space.- Returns:
- the current snapshot (never
null) - Throws:
IllegalStateException- if no snapshot can be taken at this time
-
addRef
default void addRef()Description copied from interface:IReferenceCountableSpawns a new independent ownership of this object. Each successful call toaddRef()must ultimately be followed by exactly one call toIReferenceCountable.release().- Specified by:
addRefin interfaceIReferenceCountable
-
release
default void release()Description copied from interface:IReferenceCountableRelinquishes an independent ownership of this object. Each independent ownership of the object must ultimately end with exactly one call to this method.- Specified by:
releasein interfaceIReferenceCountable- See Also:
-