You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by eb...@apache.org on 2005/01/03 13:42:31 UTC
cvs commit: jakarta-commons/configuration/xdocs changes.xml
ebourg 2005/01/03 04:42:31
Modified: configuration/src/java/org/apache/commons/configuration
AbstractFileConfiguration.java
FileConfiguration.java XMLConfiguration.java
configuration/xdocs changes.xml
Log:
Added the setEncoding(String) and the getEncoding() methods to the FileConfiguration interface to control the encoding of the configuration file.
Revision Changes Path
1.13 +20 -8 jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java
Index: AbstractFileConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- AbstractFileConfiguration.java 4 Dec 2004 15:45:40 -0000 1.12
+++ AbstractFileConfiguration.java 3 Jan 2005 12:42:30 -0000 1.13
@@ -59,8 +59,7 @@
* @version $Revision$, $Date$
* @since 1.0-rc2
*/
-public abstract class AbstractFileConfiguration extends BaseConfiguration implements
- FileConfiguration
+public abstract class AbstractFileConfiguration extends BaseConfiguration implements FileConfiguration
{
protected String fileName;
@@ -72,6 +71,8 @@
private Object reloadLock = new Object();
+ private String encoding;
+
/**
* Default constructor
*
@@ -240,8 +241,8 @@
}
/**
- * Load the configuration from the specified stream, using the default
- * platform specific encoding.
+ * Load the configuration from the specified stream, using the encoding
+ * returned by {@link #getEncoding()}.
*
* @param in the input stream
*
@@ -249,7 +250,7 @@
*/
public void load(InputStream in) throws ConfigurationException
{
- load(in, null);
+ load(in, getEncoding());
}
/**
@@ -382,7 +383,8 @@
}
/**
- * Save the configuration to the specified stream.
+ * Save the configuration to the specified stream, using the encoding
+ * returned by {@link #getEncoding()}.
*
* @param out
*
@@ -390,7 +392,7 @@
*/
public void save(OutputStream out) throws ConfigurationException
{
- save(out, null);
+ save(out, getEncoding());
}
/**
@@ -654,5 +656,15 @@
}
}
}
+ }
+
+ public String getEncoding()
+ {
+ return encoding;
+ }
+
+ public void setEncoding(String encoding)
+ {
+ this.encoding = encoding;
}
}
1.4 +21 -4 jakarta-commons/configuration/src/java/org/apache/commons/configuration/FileConfiguration.java
Index: FileConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/FileConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- FileConfiguration.java 18 Oct 2004 15:45:10 -0000 1.3
+++ FileConfiguration.java 3 Jan 2005 12:42:30 -0000 1.4
@@ -70,8 +70,8 @@
void load(URL url) throws ConfigurationException;
/**
- * Load the configuration from the specified stream, using the default
- * platform specific encoding.
+ * Load the configuration from the specified stream, using the encoding
+ * returned by {@link #getEncoding()}.
*
* @param in the input stream
*
@@ -134,7 +134,8 @@
void save(URL url) throws ConfigurationException;
/**
- * Save the configuration to the specified stream.
+ * Save the configuration to the specified stream, using the encoding
+ * returned by {@link #getEncoding()}.
*
* @param out
*
@@ -245,5 +246,21 @@
* @since 1.1
*/
void reload();
+
+ /**
+ * Return the encoding used to store the configuration file. If the value
+ * is null the default encoding is used.
+ *
+ * @since 1.1
+ */
+ String getEncoding();
+
+ /**
+ * Set the encoding used to store the configuration file. Set the encoding
+ * to null to use the default encoding.
+ *
+ * @since 1.1
+ */
+ void setEncoding(String encoding);
}
1.22 +11 -1 jakarta-commons/configuration/src/java/org/apache/commons/configuration/XMLConfiguration.java
Index: XMLConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/XMLConfiguration.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- XMLConfiguration.java 31 Dec 2004 16:00:00 -0000 1.21
+++ XMLConfiguration.java 3 Jan 2005 12:42:30 -0000 1.22
@@ -504,6 +504,16 @@
delegate.reload();
}
+ public String getEncoding()
+ {
+ return delegate.getEncoding();
+ }
+
+ public void setEncoding(String encoding)
+ {
+ delegate.setEncoding(encoding);
+ }
+
/**
* A specialized <code>Node</code> class that is connected with an XML
* element. Changes on a node are also performed on the associated element.
1.78 +5 -0 jakarta-commons/configuration/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- changes.xml 23 Dec 2004 19:18:12 -0000 1.77
+++ changes.xml 3 Jan 2005 12:42:31 -0000 1.78
@@ -8,6 +8,11 @@
<body>
<release version="1.1-dev" date="in CVS">
+ <action dev="ebourg" type="add">
+ Added the setEncoding(String) and the getEncoding() methods to the
+ FileConfiguration interface to control the encoding of the
+ configuration file.
+ </action>
<action dev="oheger" type="add" issue="31136">
Access to the top leven element of the XML document is now provided. For
newly created configurations this element can be changed before the
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org