[izpack-changes] r1664 - izpack-src/trunk/src/lib/com/izforge/izpack/installer
noreply at berlios.de
noreply at berlios.de
Wed Dec 6 16:31:47 CET 2006
Author: dreil
Date: 2006-12-06 16:31:46 +0100 (Wed, 06 Dec 2006)
New Revision: 1664
Modified:
izpack-src/trunk/src/lib/com/izforge/izpack/installer/ResourceManager.java
Log:
Added method for getting text resources in specific encoding
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/ResourceManager.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/ResourceManager.java 2006-12-04 19:16:38 UTC (rev 1663)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/ResourceManager.java 2006-12-06 15:31:46 UTC (rev 1664)
@@ -182,12 +182,13 @@
* ResourceManager#getResource and then converted into text.
*
* @param resource - a text resource to load
+ * @param encoding - the encoding, which should be used to read the resource
* @return a String contains the text of the resource
* @throws ResourceNotFoundException if the resource can not be found
* @throws IOException if the resource can not be loaded
*/
// Maybe we can add a text parser for this method
- public String getTextResource(String resource) throws ResourceNotFoundException, IOException
+ public String getTextResource(String resource, String encoding) throws ResourceNotFoundException, IOException
{
InputStream in = null;
try
@@ -205,8 +206,28 @@
while ((bytesInBuffer = in.read(buffer)) != -1)
infoData.write(buffer, 0, bytesInBuffer);
- return infoData.toString();
+ if (encoding != null){
+ return infoData.toString(encoding);
+ }
+ else {
+ return infoData.toString();
+ }
}
+
+ /**
+ * Returns a text resource from the jar file. The resource is loaded by
+ * ResourceManager#getResource and then converted into text.
+ *
+ * @param resource - a text resource to load
+ * @return a String contains the text of the resource
+ * @throws ResourceNotFoundException if the resource can not be found
+ * @throws IOException if the resource can not be loaded
+ */
+ // Maybe we can add a text parser for this method
+ public String getTextResource(String resource) throws ResourceNotFoundException, IOException
+ {
+ return this.getTextResource(resource,null);
+ }
/**
* Returns a laguage dependent ImageIcon for the given Resource
More information about the izpack-changes
mailing list