public static class PropertiesConfiguration.JupIOFactory extends Object implements PropertiesConfiguration.IOFactory
PropertiesConfiguration.IOFactory that tries to mimic the behavior of
Properties (Jup) more closely. The goal is to allow both of
them be used interchangeably when reading and writing properties files
without losing or changing information.
It also has the option to not use Unicode escapes. When using UTF-8 encoding (which is e.g. the new default for resource bundle properties files since Java 9), Unicode escapes are no longer required and avoiding them makes properties files more readable with regular text editors.
Some of the ways this implementation differs from PropertiesConfiguration.DefaultIOFactory:
\b is not a recognized escape sequence.| Constructor and Description |
|---|
JupIOFactory()
Constructs a new
PropertiesConfiguration.JupIOFactory with Unicode escaping. |
JupIOFactory(boolean escapeUnicode)
Constructs a new
PropertiesConfiguration.JupIOFactory with optional Unicode escaping. |
| Modifier and Type | Method and Description |
|---|---|
PropertiesConfiguration.PropertiesReader |
createPropertiesReader(Reader in)
Creates a
PropertiesReader for reading a properties
file. |
PropertiesConfiguration.PropertiesWriter |
createPropertiesWriter(Writer out,
ListDelimiterHandler handler)
Creates a
PropertiesWriter for writing a properties
file. |
public JupIOFactory()
PropertiesConfiguration.JupIOFactory with Unicode escaping.public JupIOFactory(boolean escapeUnicode)
PropertiesConfiguration.JupIOFactory with optional Unicode escaping. Whether
Unicode escaping is required depends on the encoding used to save the
properties file. E.g. for ISO-8859-1 this must be turned on, for UTF-8 it's
not necessary. Unfortunately this factory can't determine the encoding on its
own.escapeUnicode - whether Unicode characters should be escapedpublic PropertiesConfiguration.PropertiesReader createPropertiesReader(Reader in)
PropertiesConfiguration.IOFactoryPropertiesReader for reading a properties
file. This method is called whenever the
PropertiesConfiguration is loaded. The reader returned
by this method is then used for parsing the properties file.createPropertiesReader in interface PropertiesConfiguration.IOFactoryin - the underlying reader (of the properties file)PropertiesReader for loading the
configurationpublic PropertiesConfiguration.PropertiesWriter createPropertiesWriter(Writer out, ListDelimiterHandler handler)
PropertiesConfiguration.IOFactoryPropertiesWriter for writing a properties
file. This method is called before the
PropertiesConfiguration is saved. The writer returned by
this method is then used for writing the properties file.createPropertiesWriter in interface PropertiesConfiguration.IOFactoryout - the underlying writer (to the properties file)handler - the list delimiter delimiter for list parsingPropertiesWriter for saving the
configurationCopyright © 2001–2020 The Apache Software Foundation. All rights reserved.