java.lang.Object
java.lang.Enum<InputType>
org.apache.sis.internal.storage.xml.stream.InputType
All Implemented Interfaces:
Serializable, Comparable<InputType>, java.lang.constant.Constable

enum InputType extends Enum<InputType>
Creates XMLStreamReader from a given input. This enumeration allows to analyze the input type only once before to create as many instances of XMLStreamReader as needed for that input. The enumeration order is the preference order (i.e. we will test if the object already implements the XMLStreamReader interface before to test for InputStream, Reader, etc.).

Some kinds of inputs can be used many time (for example Node). Other inputs can be used only once (for example XMLEventReader). For some inputs, it depends on whether the stream support marks.

Since:
0.8
Version:
0.8
  • Enum Constant Details

    • STAX

      public static final InputType STAX
      The input is already an instance of XMLStreamReader. That input is returned directly and can be used only once.
    • STREAM

      public static final InputType STREAM
      The input is an instance of Java I/O InputStream. Decoding may depend on the data store character encoding.
    • CHARACTERS

      public static final InputType CHARACTERS
      The input is an instance of Java I/O Reader.
    • SOURCE

      public static final InputType SOURCE
      The input is an instance of XML Source, which is itself a wrapper around another kind of source.
    • NODE

      public static final InputType NODE
      The input is an instance of DOM Node.
    • SAX

      public static final InputType SAX
      The input is an instance of SAX InputSource.
    • EVENT

      public static final InputType EVENT
      The input is an instance of STAX XMLEventReader.
  • Field Details

    • inputType

      private final Class<?> inputType
      The kind of input that this enumeration can handle.
  • Constructor Details

    • InputType

      private InputType(Class<?> inputType)
      Creates a new enumeration for the given type of input.
  • Method Details

    • values

      public static InputType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static InputType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • create

      abstract XMLStreamReader create(StaxDataStore ds, Object s) throws XMLStreamException
      Creates a XML reader for the given input.
      Parameters:
      ds - the data store for which to create reader instances.
      s - the input stream or the storage object (URL, etc).
      Returns:
      the XML reader.
      Throws:
      XMLStreamException - if the XML reader creation failed.
    • forType

      static InputType forType(Class<?> type)
      Returns a ReaderFactory for the given input type. The type argument given to this method shall be the class of the s argument to be given in create(StaxDataStore, Object) calls.
      Parameters:
      type - the type of the input stream or storage object (URL, etc).
      Returns:
      a factory for the given stream or storage type, or null if the given type is not recognized.