Package com.yubico.yubikit.core
Class Version
java.lang.Object
com.yubico.yubikit.core.Version
- All Implemented Interfaces:
Comparable<Version>
A 3-part version number, used by the YubiKey firmware and its various applications.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
static Version
fromBytes
(byte[] bytes) Parses a Version from a byte array by taking the first three bytes.byte[]
getBytes()
Returns the version components as a byte array of size 3.int
hashCode()
boolean
isAtLeast
(int major, int minor, int micro) Returns whether or not the Version is greater than or equal to a given version.boolean
isLessThan
(int major, int minor, int micro) Returns whether or not the Version is less than a given version.static Version
Parses a Version from a String (eg.toString()
-
Field Details
-
major
public final byte major -
minor
public final byte minor -
micro
public final byte micro
-
-
Constructor Details
-
Version
public Version(int major, int minor, int micro) Constructor using int's for convenience.Each version component will be checked to ensure it falls within an acceptable range.
-
Version
public Version(byte major, byte minor, byte micro) Constructs a new Version object.
-
-
Method Details
-
getBytes
public byte[] getBytes()Returns the version components as a byte array of size 3. -
compareTo
- Specified by:
compareTo
in interfaceComparable<Version>
-
isLessThan
public boolean isLessThan(int major, int minor, int micro) Returns whether or not the Version is less than a given version. -
isAtLeast
public boolean isAtLeast(int major, int minor, int micro) Returns whether or not the Version is greater than or equal to a given version. -
equals
-
hashCode
public int hashCode() -
toString
-
fromBytes
Parses a Version from a byte array by taking the first three bytes.Additional bytes in the array are ignored.
-
parse
Parses a Version from a String (eg. "Firmware version 5.2.1")- Parameters:
versionString
- string that contains a 3-part version, separated by dots.
-