summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-java/obantoo/files/1.4.11-hibiscus-encoding.patch')
-rw-r--r--dev-java/obantoo/files/1.4.11-hibiscus-encoding.patch151
1 files changed, 151 insertions, 0 deletions
diff --git a/dev-java/obantoo/files/1.4.11-hibiscus-encoding.patch b/dev-java/obantoo/files/1.4.11-hibiscus-encoding.patch
new file mode 100644
index 0000000..29e74ca
--- /dev/null
+++ b/dev-java/obantoo/files/1.4.11-hibiscus-encoding.patch
@@ -0,0 +1,151 @@
+--- src/de/jost_net/OBanToo/Dtaus/DtausDateiParser.java 2008-07-09 15:02:58.000000000 +0200
++++ DtausDateiParser.java 2010-12-28 15:45:29.907892004 +0100
+@@ -1,7 +1,7 @@
+ /*
+ * $Source: /cvsroot/obantoo/obantoo/src/de/jost_net/OBanToo/Dtaus/DtausDateiParser.java,v $
+- * $Revision: 1.8 $
+- * $Date: 2008/02/17 08:30:46 $
++ * $Revision: 1.10 $
++ * $Date: 2008/08/23 12:18:30 $
+ * $Author: jost $
+ *
+ * Copyright 2006 by Heiner Jostkleigrewe
+@@ -24,7 +24,8 @@
+ * </p>
+ * <p>
+ * Dem Parser kann über einen speziellen Konstruktor mitgeteilt werden, wie
+- * fehlertolerant er sein soll.
++ * fehlertolerant er sein soll. Standardmässig wird das Encoding ISO-8859-1
++ * verwendet. In einem Konstruktor kann ein anderes Encoding vorgegeben werden.
+ * <ul>
+ * <li>SPEZIFIKATIONSKONFORM - entsprechend der DTAUS-Spezifikation wird ohne
+ * Fehlertoleranz gearbeitet.</li>
+@@ -81,6 +82,8 @@
+ */
+ public class DtausDateiParser
+ {
++ private String encoding = "ISO-8859-1";
++
+ private InputStream dtaus;
+
+ private ASatz asatz = null;
+@@ -116,6 +119,13 @@
+ this(new BufferedInputStream(new FileInputStream(filename)), toleranz);
+ }
+
++ public DtausDateiParser(String filename, int toleranz, String encoding)
++ throws IOException, DtausException
++ {
++ this(new BufferedInputStream(new FileInputStream(filename)), toleranz,
++ encoding);
++ }
++
+ public DtausDateiParser(InputStream is) throws IOException, DtausException
+ {
+ this(is, SPEZIFIKATIONSKONFORM);
+@@ -124,7 +134,18 @@
+ public DtausDateiParser(InputStream is, int toleranz) throws IOException,
+ DtausException
+ {
++ this(is, toleranz, null);
++ }
++
++ public DtausDateiParser(InputStream is, int toleranz, String encoding)
++ throws IOException, DtausException
++ {
+ this.toleranz = toleranz;
++ if (encoding != null)
++ {
++ this.encoding = encoding;
++ }
++
+ logischeDateien = new Vector();
+ dtaus = is;
+ while (is.available() > 0)
+@@ -201,13 +222,13 @@
+ {
+ byte[] inchar = new byte[4];
+ dtaus.read(inchar);
+- String satzlaenge = new String(inchar);
++ String satzlaenge = new String(inchar, this.encoding);
+ // Lese in der Satzlänge. Die Satzlänge ist um 4 Bytes zu verringern, da
+ // diese
+ // Bytes bereits gelesen wurden.
+ inchar = new byte[getSatzlaenge(satzlaenge) - 4];
+ dtaus.read(inchar);
+- return satzlaenge + new String(inchar);
++ return satzlaenge + new String(inchar, this.encoding);
+ }
+
+ /**
+@@ -262,15 +283,17 @@
+ public static void main(String[] args)
+ {
+ int tol = 0;
+- if (args.length < 1 || args.length > 2)
++ String encoding = null;
++ if (args.length < 1 || args.length > 3)
+ {
+- System.err.println("Argumente für den Aufruf: dateiname [toleranz]\n"
+- + "toleranz = 0 Spezifikationskonform\n"
+- + "toleranz = 1 DOS-Umlaute umwandeln\n"
+- + "toleranz = 2 Zeichencode 00 in Space umwandeln");
++ System.err
++ .println("Argumente für den Aufruf: dateiname [toleranz] [encoding]\n"
++ + "toleranz = 0 Spezifikationskonform\n"
++ + "toleranz = 1 DOS-Umlaute umwandeln\n"
++ + "toleranz = 2 Zeichencode 00 in Space umwandeln");
+ System.exit(1);
+ }
+- if (args.length == 2)
++ if (args.length >= 2)
+ {
+ try
+ {
+@@ -282,9 +305,21 @@
+ System.exit(1);
+ }
+ }
++ if (args.length == 3)
++ {
++ encoding = args[2];
++ }
+ try
+ {
+- DtausDateiParser p = new DtausDateiParser(args[0], tol);
++ DtausDateiParser p;
++ if (encoding == null)
++ {
++ p = new DtausDateiParser(args[0], tol);
++ }
++ else
++ {
++ p = new DtausDateiParser(args[0], tol, encoding);
++ }
+ System.out.println("Anzahl logischer Dateien: "
+ + p.getAnzahlLogischerDateien());
+ for (int i = 1; i <= p.getAnzahlLogischerDateien(); i++)
+@@ -320,10 +355,13 @@
+ }
+ /*
+ * $Log: DtausDateiParser.java,v $
+- * Revision 1.8 2008/02/17 08:30:46 jost
+- * Neuer Toleranzlevel
+- * Neues Feld5
+- * Revision 1.7 2007/02/14 14:42:54 jost javadoc
++ * Revision 1.10 2008/08/23 12:18:30 jost
++ * Encoding kann als Kommandozeilenparameter an die main-Methode übergeben werden.
++ * Revision 1.9 2008/07/09 19:43:28 jost Patch
++ * von Olaf Willuhn: Standardmässig wird das Encoding ISO-8859-1 verwendet.
++ * Optional kann über zusätzliche Konstruktoren ein anderes Encoding
++ * eingestellt werden. Revision 1.8 2008/02/17 08:30:46 jost Neuer Toleranzlevel
++ * Neues Feld5 Revision 1.7 2007/02/14 14:42:54 jost javadoc
+ *
+ * Revision 1.6 2006/10/06 12:47:39 jost Optionale Fehlertoleranz Revision 1.5
+ * 2006/06/04 12:23:51 jost Redaktionelle Änderung
+@@ -333,5 +371,4 @@
+ * Dateien pro physikalischer Datei - interne Umstellung von Reader auf
+ * InputStream Revision 1.2 2006/05/25 20:30:40 jost Korrektur Satzlängen und
+ * Doku Revision 1.1 2006/05/24 16:24:44 jost Prerelease
+- *
+ */