public final class JProperties
extends java.lang.Object
JProperties class provides an up-to-date way to parse Java properties files.
Java's standard library includes the Properties by default,
and it is used by most applications that require working with properties files,
but this class is outdated for a large number of reasons.
Hashtable class, of which has been superseded by ConcurrentHashMap,
the latter is a much more efficient, up-to-date class.
Properties in a non-concurrent way,
which may be useful for efficiency if the properties are only accessed by one thread.
Properties from a InputStream or Reader,
which makes code more verbose.
Properties
are Properties.loadFromXML(InputStream) and Properties.storeToXML(java.io.OutputStream, java.lang.String),
while JProperties offers a way to declare converters to and from other formats, such as XML.
Properties extends Hashtable and was never retrofitted for generics,
it technically extends Hashtable<Object, Object>, which means that the designers of the class
had to make type-safety work using the Properties.setProperty(java.lang.String, java.lang.String) and Properties.getProperty(java.lang.String) methods,
making the get and set overridden from Hashtable redundant.
Map as opposed to a custom Hashtable implementation,
and so this class provides utility methods for converting Maps with standard Converter implementations.Converters| Modifier and Type | Method and Description |
|---|---|
static java.util.Map<java.lang.String,java.lang.String> |
from(byte[] bytes) |
static java.util.Map<java.lang.String,java.lang.String> |
from(java.io.File file) |
static java.util.Map<java.lang.String,java.lang.String> |
from(java.io.InputStream stream) |
static java.util.Map<java.lang.String,java.lang.String> |
from(java.nio.file.Path path) |
static java.util.Map<java.lang.String,java.lang.String> |
from(java.util.Properties props) |
static java.util.Map<java.lang.String,java.lang.String> |
from(java.lang.String s) |
static java.util.Map<java.lang.String,java.lang.String> |
fromConcurrent(byte[] bytes) |
static java.util.Map<java.lang.String,java.lang.String> |
fromConcurrent(java.io.File file) |
static java.util.Map<java.lang.String,java.lang.String> |
fromConcurrent(java.io.InputStream stream) |
static java.util.Map<java.lang.String,java.lang.String> |
fromConcurrent(java.nio.file.Path path) |
static java.util.Map<java.lang.String,java.lang.String> |
fromConcurrent(java.util.Properties props) |
static java.util.Map<java.lang.String,java.lang.String> |
fromConcurrent(java.lang.String s) |
static java.util.Map<java.lang.String,java.lang.String> |
fromResource(java.lang.String name) |
static java.util.Map<java.lang.String,java.lang.String> |
fromResourceConcurrent(java.lang.String name) |
public static java.util.Map<java.lang.String,java.lang.String> from(java.io.InputStream stream)
public static java.util.Map<java.lang.String,java.lang.String> from(java.io.File file)
public static java.util.Map<java.lang.String,java.lang.String> from(java.nio.file.Path path)
public static java.util.Map<java.lang.String,java.lang.String> from(byte[] bytes)
public static java.util.Map<java.lang.String,java.lang.String> from(java.lang.String s)
public static java.util.Map<java.lang.String,java.lang.String> from(java.util.Properties props)
public static java.util.Map<java.lang.String,java.lang.String> fromConcurrent(java.io.InputStream stream)
public static java.util.Map<java.lang.String,java.lang.String> fromConcurrent(java.io.File file)
public static java.util.Map<java.lang.String,java.lang.String> fromConcurrent(java.nio.file.Path path)
public static java.util.Map<java.lang.String,java.lang.String> fromConcurrent(byte[] bytes)
public static java.util.Map<java.lang.String,java.lang.String> fromConcurrent(java.lang.String s)
public static java.util.Map<java.lang.String,java.lang.String> fromConcurrent(java.util.Properties props)
public static java.util.Map<java.lang.String,java.lang.String> fromResource(java.lang.String name)
public static java.util.Map<java.lang.String,java.lang.String> fromResourceConcurrent(java.lang.String name)