# Interface DataStoreProvider.Prober<S>

Type Parameters:
  `S` - the source type as one of `ByteBuffer`, `DataInput` or other classes documented in `StorageConnector​.getStorageAs(Class)`.

Enclosing class:
  `DataStoreProvider`

Functional Interface:
  This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface protected static interface DataStoreProvider.Prober<S>
An action to execute for testing if a `StorageConnector` input can be read. This action is invoked by `DataStoreProvider​.probeContent(StorageConnector, Class, Prober)` with an input of the type `<S>` specified to the `probe(…)` method. The `DataStoreProvider` is responsible for restoring the input to its initial position after the probe action completed.

Since:
  1.2
See Also:
  - `DataStoreProvider​.probeContent(StorageConnector, Class, Prober)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default <A> DataStoreProvider​.Prober<S>`
  `orElse(Class<A> type, DataStoreProvider​.Prober<? super A> alternative)`
  Returns a composed probe that attempts, in sequence, this probe followed by the alternative probe if the first probe cannot be executed.
  `ProbeResult`
  `test(S input)`
  Probes the given input and returns an indication about whether that input is supported.

- ## Method Details

  - ### test

    ProbeResult test(S input) throws Exception
    Probes the given input and returns an indication about whether that input is supported. This method may return `SUPPORTED` if there is reasonable chance of success based on a brief inspection of the given input; the supported status does not need to be guaranteed.
    Parameters:
      `input` - the input to probe. This is for example a `ByteBuffer` or a `DataInput`.
    Returns:
      the result of executing the probe action with the given source. Should not be null.
    Throws:
      `Exception` - if an error occurred during the execution of the probe action.

  - ### orElse

    default <A> DataStoreProvider.Prober<S> orElse(Class<A> type, DataStoreProvider.Prober<? super A> alternative)
    Returns a composed probe that attempts, in sequence, this probe followed by the alternative probe if the first probe cannot be executed. The alternative probe is tried if and only if one of the following conditions is true:
    - The storage connector cannot provide an input of the type requested by this probe.
    - This probe `test(S)` method returned `ProbeResult​.UNDETERMINED`.
    If any probe throws an exception, the exception is propagated (the alternative probe is not a fallback executed if this probe threw an exception).
    Type Parameters:
      `A` - the compile-time type of the `type` argument (the source or storage type).
    Parameters:
      `type` - the desired type as one of `ByteBuffer`, `DataInput`, etc.
      `alternative` - the test to apply on the source of the given type.
    Returns:
      a composed probe that attempts the given probe if this probe cannot be executed.