Enum SrxVersion

java.lang.Object
java.lang.Enum<SrxVersion>
net.loomchild.segment.srx.io.SrxVersion
All Implemented Interfaces:
Serializable, Comparable<SrxVersion>

public enum SrxVersion extends Enum<SrxVersion>
Represents SRX version. Responsible for retrieving SRX version from a reader without modifying it.
  • Enum Constant Details

    • VERSION_1_0

      public static final SrxVersion VERSION_1_0
    • VERSION_2_0

      public static final SrxVersion VERSION_2_0
  • Field Details

    • HEADER_BUFFER_LENGHT

      private static final int HEADER_BUFFER_LENGHT
      See Also:
    • VERSION_PATTERN

      private static final Pattern VERSION_PATTERN
    • versionString

      private String versionString
  • Constructor Details

    • SrxVersion

      private SrxVersion(String versionString)
  • Method Details

    • values

      public static SrxVersion[] 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 SrxVersion 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
    • toString

      public String toString()
      Overrides:
      toString in class Enum<SrxVersion>
    • parse

      public static SrxVersion parse(String versionString)
    • parse

      public static SrxVersion parse(BufferedReader reader)
      Returns SRX document version. Works simply by looking in document header of length HEADER_BUFFER_LENGHT and trying to match version regular expression, so it is imperfect. It must be possible to mark the given reader (Reader.mark(int)).
      Parameters:
      reader - buffered reader containing SRX document with unknown version
      Returns:
      version string
      Throws:
      IORuntimeException - if IO error occurs
      IllegalArgumentException - if reader does not support marking