Module org.apache.sis.storage
Package org.apache.sis.storage

# Class DataStoreContentException

Object
Throwable
Exception
DataStoreException
DataStoreContentException

All Implemented Interfaces:
  `Serializable`, `LocalizedException`

Direct Known Subclasses:
  `UnsupportedEncodingException`

public class DataStoreContentException extends DataStoreException
Thrown when a store cannot be read because the stream contains invalid data. It may be for example a logical inconsistency, or a reference not found, or an unsupported file format version, etc.

## Usage note

Exceptions that are caused by `IOException` or `SQLException` should generally be wrapped by another type of `DataStoreException`, unless the data store can determine that the error was caused by a problem with the stream content rather than some I/O problems.

Since:
  0.8
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DataStoreContentException(String message)`
  Creates an exception with the specified details message.
  `DataStoreContentException(String message, Throwable cause)`
  Creates an exception with the specified details message and cause.
  `DataStoreContentException(Throwable cause)`
  Creates an exception with the specified cause and no details message.
  `DataStoreContentException(Locale locale, String format, String filename, Object store)`
  Creates a localized exception with a message saying that the given store cannot be read.

- ## Method Summary

  ### Methods inherited from class DataStoreException

  `getInternationalMessage, getLocalizedMessage, getMessage, initCause`

  ### Methods inherited from class Throwable

  `addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### DataStoreContentException

    public DataStoreContentException(String message)
    Creates an exception with the specified details message.
    Parameters:
      `message` - the detail message.

  - ### DataStoreContentException

    public DataStoreContentException(Throwable cause)
    Creates an exception with the specified cause and no details message.
    Parameters:
      `cause` - the cause for this exception.

  - ### DataStoreContentException

    public DataStoreContentException(String message, Throwable cause)
    Creates an exception with the specified details message and cause.
    Parameters:
      `message` - the detail message.
      `cause` - the cause for this exception.

  - ### DataStoreContentException

    public DataStoreContentException(Locale locale, String format, String filename, Object store)
    Creates a localized exception with a message saying that the given store cannot be read. Location in the file where the error occurred while be fetched from the given `store` argument if possible. If the given store is not recognized, then it will be ignored.

    Examples of messages created by this constructor:

    - Cannot read “Foo” as a file in the Bar format.
    - Cannot read after column 10 or line 100 of “Foo” as part of a file in the Bar format.
    Parameters:
      `locale` - the locale of the message to be returned by `DataStoreException​.getLocalizedMessage()`, or `null`.
      `format` - short name or abbreviation of the data format (e.g. "CSV", "GML", "WKT", etc).
      `filename` - name of the file or data store where the error occurred.
      `store` - the input or output object from which to get the current position, or `null` if none. This can be a `LineNumberReader` or `XMLStreamReader` for example.