Package org.eclipse.hono.config
Enum FileFormat
- java.lang.Object
-
- java.lang.Enum<FileFormat>
-
- org.eclipse.hono.config.FileFormat
-
- All Implemented Interfaces:
Serializable
,Comparable<FileFormat>
public enum FileFormat extends Enum<FileFormat>
File formats for using key materials.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FileFormat
detect(String path)
Detect the file format based on the file name extension.static FileFormat
orDetect(FileFormat format, String path)
Use the provided file format or detect.static FileFormat
valueOf(String name)
Returns the enum constant of this type with the specified name.static FileFormat[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
PEM
public static final FileFormat PEM
PEM encoded PKCS#1 or PKCS#8.
-
JKS
public static final FileFormat JKS
Java Key Store.
-
PKCS12
public static final FileFormat PKCS12
PKCS#12 key store.
-
-
Method Detail
-
values
public static FileFormat[] 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 (FileFormat c : FileFormat.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static FileFormat 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 nameNullPointerException
- if the argument is null
-
orDetect
public static FileFormat orDetect(FileFormat format, String path)
Use the provided file format or detect. If the file format is not provided the method will try to detect it by a call todetect(String)
.- Parameters:
format
- The provided format, may benull
path
- The path to check, may benull
, in which the result will beOptional.empty()
.- Returns:
- The provided or detected file format, may return
null
if the path isnull
or the format could not be detected. Never returnsnull
when parameterformat
is notnull
.
-
detect
public static FileFormat detect(String path)
Detect the file format based on the file name extension.- Parameters:
path
- The relative or absolute file name, may benull
- Returns:
- the detected file format, may return
null
if the path isnull
or the format culd not be detected.
-
-