Package net.loomchild.segment.srx.io
Enum SrxVersion
- java.lang.Object
-
- java.lang.Enum<SrxVersion>
-
- net.loomchild.segment.srx.io.SrxVersion
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<SrxVersion>
public enum SrxVersion extends java.lang.Enum<SrxVersion>
Represents SRX version. Responsible for retrieving SRX version from a reader without modifying it.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description VERSION_1_0VERSION_2_0
-
Field Summary
Fields Modifier and Type Field Description private static intHEADER_BUFFER_LENGHTprivate static java.util.regex.PatternVERSION_PATTERNprivate java.lang.StringversionString
-
Constructor Summary
Constructors Modifier Constructor Description privateSrxVersion(java.lang.String versionString)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SrxVersionparse(java.io.BufferedReader reader)Returns SRX document version.static SrxVersionparse(java.lang.String versionString)java.lang.StringtoString()static SrxVersionvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static SrxVersion[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
VERSION_1_0
public static final SrxVersion VERSION_1_0
-
VERSION_2_0
public static final SrxVersion VERSION_2_0
-
-
Field Detail
-
HEADER_BUFFER_LENGHT
private static final int HEADER_BUFFER_LENGHT
- See Also:
- Constant Field Values
-
VERSION_PATTERN
private static final java.util.regex.Pattern VERSION_PATTERN
-
versionString
private java.lang.String versionString
-
-
Method Detail
-
values
public static SrxVersion[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SrxVersion c : SrxVersion.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SrxVersion valueOf(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Enum<SrxVersion>
-
parse
public static SrxVersion parse(java.lang.String versionString)
-
parse
public static SrxVersion parse(java.io.BufferedReader reader)
Returns SRX document version. Works simply by looking in document header of lengthHEADER_BUFFER_LENGHTand 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 occursjava.lang.IllegalArgumentException- if reader does not support marking
-
-