* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two. You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries. If you modify this file, you may extend this
- * exception to your version of the file, but you are not obligated to do so.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your version.
*/
package tool;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.util.Arrays;
import java.util.Iterator;
+import java.util.List;
import mir.util.ExceptionFunctions;
import mir.util.PropertiesManipulator;
PropertiesManipulator result;
try {
- master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster)));
+ master = PropertiesManipulator.readProperties(
+ new BufferedInputStream(
+ new FileInputStream(new File(aMaster)),8192));
}
catch (Throwable t) {
System.out.println("Unable to read master properties: " + t.getMessage());
}
try {
- slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave)));
+ slave = PropertiesManipulator.readProperties(
+ new BufferedInputStream(
+ new FileInputStream(new File(aSlave)),8192));
}
catch (FileNotFoundException t) {
slave = new PropertiesManipulator();
PropertiesManipulator result;
try {
- master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster)));
+ master = PropertiesManipulator.readProperties(
+ new BufferedInputStream(
+ new FileInputStream(new File(aMaster)),8192));
}
catch (Throwable t) {
System.out.println("Unable to read master properties: " + t.getMessage());
}
try {
- slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave)));
+ slave = PropertiesManipulator.readProperties(
+ new BufferedInputStream(
+ new FileInputStream(new File(aSlave)),8192));
}
catch (FileNotFoundException t) {
slave = new PropertiesManipulator();
}
try {
- PropertiesManipulator.writeProperties(result, new FileOutputStream(new File(aSlave)));
+ PropertiesManipulator.writeProperties(result,
+ new BufferedOutputStream(new FileOutputStream(new File(aSlave)),8192));
}
catch (Throwable t) {
System.out.println("Unable to write slave properties: " + t.getMessage());
PropertiesManipulator bundle;
try {
- bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aBundle)));
+ bundle = PropertiesManipulator.readProperties(
+ new BufferedInputStream(
+ new FileInputStream(new File(aBundle)),8192));
- PropertiesManipulator.writeProperties(bundle, new FileOutputStream(anOutputFile), anEncoding, false);
+ PropertiesManipulator.writeProperties(bundle,
+ new BufferedOutputStream(new FileOutputStream(anOutputFile),8192), anEncoding, false);
}
catch (Throwable t) {
System.out.println("Unable to read master properties: " + t.getMessage());
PropertiesManipulator bundle;
try {
- bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aSourceFile)), anEncoding);
+ bundle = PropertiesManipulator.readProperties(
+ new BufferedInputStream(
+ new FileInputStream(new File(aSourceFile)),8192), anEncoding);
}
catch (Throwable t) {
Throwable s = ExceptionFunctions.traceCauseException(t);
return;
}
try {
- PropertiesManipulator.writeProperties(bundle, new FileOutputStream(aBundle));
+ PropertiesManipulator.writeProperties(bundle,
+ new BufferedOutputStream(new FileOutputStream(aBundle),8192));
}
catch (Throwable t) {
System.out.println("Unable to write bundle: " + t.toString());
}
}
+ public static void rename(String anOldKeyName, String aNewKeyName, List aBundles) {
+ /*
+ PropertiesManipulator bundle;
+
+ try {
+ bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aBundle)));
+
+ PropertiesManipulator.writeProperties(bundle, new FileOutputStream(anOutputFile), anEncoding, false);
+ }
+ catch (Throwable t) {
+ System.out.println("Unable to read master properties: " + t.getMessage());
+ return;
+ }
+*/
+ }
+
+
public static void main(String[] anArguments) {
String command = "help";
return;
}
}
- }
+ else if (command.equals("rename")) {
+ if (anArguments.length>=3) {
+ List arguments = Arrays.asList(anArguments);
+ rename(anArguments[0], anArguments[1], arguments.subList(2, arguments.size()));
+/*
+ decode(anArguments[1], anArguments[2], anArguments[3]);
+*/
+ return;
+ }
+ }
+ }
System.out.println("Usage:");
System.out.println(" BundleTool decode <bundle> <encoding> <sourcefile>");
System.out.println("");
System.out.println(" Decodes the keys/values with a custom encoding.");
+ System.out.println(" BundleTool rename <old key> <new key> <bundle> [<bundle> [ ... ]]");
+ System.out.println("");
+ System.out.println(" Decodes the keys/values with a custom encoding.");
}
}
\ No newline at end of file