Package org.openpreservation.format.xml
Enum Class Encodings
- All Implemented Interfaces:
Serializable
,Comparable<Encodings>
,java.lang.constant.Constable
An enum defining the Byte Order Marks for UTF-8, UTF-16 and UTF-32.
See Byte Order Mark
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Encodings
fromEncoding
(String encoding) Get anEncodings
instance from the String name orNONE
if no matchstatic Encodings
fromRepresentation
(byte[] bytes) Get anEncodings
instance from the byte array representation, orNONE
if no match.int
Returns the length of the Byte Order Mark in bytesstatic Encodings
Returns the enum constant of this class with the specified name.static Encodings[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
Empty Byte String to match no encoding -
UTF_8
UTF-8 Byte Order Mark -
UTF_16_BE
UTF-16 Big Endian Byte Order Mark -
UTF_16_LE
UTF-16 Little Endian Byte Order Mark -
UTF_32_BE
UTF-32 Big Endian Byte Order Mark -
UTF_32_LE
UTF-32 Little Endian Byte Order Mark
-
-
Field Details
-
encoding
TheString
encoding name for the Byte Order Mark
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-
fromEncoding
Get anEncodings
instance from the String name orNONE
if no match- Parameters:
encoding
- the name of the encoding to retrieve- Returns:
- the Endcoding with the given name, or
Encoding.NONE
if no match - Throws:
NullPointerException
- ifencoding
isnull
-
fromRepresentation
Get anEncodings
instance from the byte array representation, orNONE
if no match.- Parameters:
bytes
- thebyte[]
representation of the encoding to retrieve- Returns:
- the
Endcodings
instance with the given representation, orEncoding.NONE
if no match - Throws:
NullPointerException
- ifbytes
isnull
.
-
getLength
public int getLength()Returns the length of the Byte Order Mark in bytes- Returns:
- the
int
length of the Byte Order Mark in bytes
-