Package org.eclipse.handly.snapshot

## Class NonExpiringSnapshot

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

- All Implemented Interfaces:
    `ISnapshot`

      public final class NonExpiringSnapshot
      extends Snapshot

  A snapshot that never expires. It never returns `null` from `getContents()`; it wraps another snapshot and holds on to its contents.

  Protractedly holding on to non-expiring snapshots is not recommended, as they may potentially consume large amount of space.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `NonExpiringSnapshot​(ISnapshotProvider provider)` | Takes a snapshot from the given provider and wraps it in a new non-expiring snapshot.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getContents()` | Returns the cached contents of the wrapped snapshot.
    `ISnapshot` | `getWrappedSnapshot()` | Returns the snapshot wrapped by this snapshot.

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

      `isEqualTo, predictEquality`

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

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

- - ### Constructor Detail

    - #### NonExpiringSnapshot

          public NonExpiringSnapshot​(ISnapshotProvider provider)

      Takes a snapshot from the given provider and wraps it in a new non-expiring snapshot.
      Parameters:
        `provider` - a snapshot provider from which a snapshot is to be taken (not `null`)
      Throws:
        `java.lang.IllegalStateException` - if the snapshot could not be created because of an inappropriate state of the snapshot provider

  - ### Method Detail

    - #### getContents

          public java.lang.String getContents()

      Returns the cached contents of the wrapped snapshot.

      Protractedly holding on to the returned contents is not recommended, as it may potentially consume significant amount of space.

      Returns:
        the cached contents of the wrapped snapshot (never `null`)

    - #### getWrappedSnapshot

          public ISnapshot getWrappedSnapshot()

      Returns the snapshot wrapped by this snapshot.
      Returns:
        the wrapped snapshot (never `null`)