Moved all constants to MConstants.
authorMarco Zanon <info@marcozanon.com>
Mon, 10 Jul 2017 12:48:25 +0000 (12:48 +0000)
committerMarco Zanon <info@marcozanon.com>
Mon, 10 Jul 2017 12:48:25 +0000 (12:48 +0000)
5.x/src/java/com/marcozanon/macaco/MInformation.java
5.x/src/java/com/marcozanon/macaco/logging/MLogPlainTextFile.java
5.x/src/java/com/marcozanon/macaco/text/MText.java
5.x/src/java/com/marcozanon/macaco/text/MTranslator.java

index 79791ea732866b6ca1ad21f8b7ae3ec53795ca42..32a9516003cac202b7f8d95efbc2339352526380 100644 (file)
@@ -12,14 +12,10 @@ import java.io.StringWriter;
 
 public class MInformation extends MObject {
 
-    public static final String MACACO_VERSION = "5.x";
-
-    public static final String TEXT_ENCODING = "UTF-8";
-
     /* Generic information. */
 
     public static String getMacacoVersion() {
-        return MInformation.MACACO_VERSION;
+        return MConstants.MACACO_VERSION;
     }
 
     public static String getMacacoFullName() {
index 9b2011f301c323deee9553bbc7a2cfb07f1d9c57..20b4bb7e7e76f9efb0f99172faa33a5d7d056127 100644 (file)
@@ -6,6 +6,7 @@
 
 package com.marcozanon.macaco.logging;
 
+import com.marcozanon.macaco.MConstants;
 import com.marcozanon.macaco.MInformation;
 import com.marcozanon.macaco.text.MText;
 import java.io.BufferedWriter;
@@ -34,7 +35,7 @@ public class MLogPlainTextFile extends MLogTarget {
         //
         this.file = file;
         try {
-            this.buffer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.getFile(), true), MInformation.TEXT_ENCODING));
+            this.buffer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.getFile(), true), MConstants.TEXT_ENCODING));
         }
         catch (FileNotFoundException exception) {
             throw new MLoggingException("Could not open file.", exception);
index f89852be7918528d55f63c633cde8288c2a1235f..44fdb0357cc1b2850aab17413225917f85523305 100644 (file)
@@ -6,6 +6,7 @@
 
 package com.marcozanon.macaco.text;
 
+import com.marcozanon.macaco.MConstants;
 import com.marcozanon.macaco.MInformation;
 import com.marcozanon.macaco.MObject;
 import java.io.BufferedInputStream;
@@ -371,7 +372,7 @@ public class MText extends MObject {
         String text = x;
         //
         StringBuilder fakeXhtmlPageContent = new StringBuilder("");
-        fakeXhtmlPageContent.append(String.format("<?xml version=\"1.0\" encoding=\"%s\" ?>", MInformation.TEXT_ENCODING));
+        fakeXhtmlPageContent.append(String.format("<?xml version=\"1.0\" encoding=\"%s\" ?>", MConstants.TEXT_ENCODING));
         fakeXhtmlPageContent.append("<!DOCTYPE html SYSTEM \"fake-dtd\" >");
         fakeXhtmlPageContent.append("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
         fakeXhtmlPageContent.append("<head><title /></head>");
@@ -421,7 +422,7 @@ public class MText extends MObject {
 
             });
             //
-            reader.parse(new InputSource(new ByteArrayInputStream(fakeXhtmlPageContent.toString().getBytes(MInformation.TEXT_ENCODING))));
+            reader.parse(new InputSource(new ByteArrayInputStream(fakeXhtmlPageContent.toString().getBytes(MConstants.TEXT_ENCODING))));
         }
         catch (ParserConfigurationException exception) { // cannot happen
         }
index 8c3f8e34aff850e004138d5f5663585aae00b3ed..cdddd3b52a26271bd49101b58d39b2085dbdc551 100644 (file)
@@ -6,6 +6,7 @@
 
 package com.marcozanon.macaco.text;
 
+import com.marcozanon.macaco.MConstants;
 import com.marcozanon.macaco.MInformation;
 import com.marcozanon.macaco.MObject;
 import java.io.FileInputStream;
@@ -74,7 +75,7 @@ public class MTranslator extends MObject {
         //
         LineNumberReader buffer = null;
         try {
-            buffer = new LineNumberReader(new InputStreamReader(new FileInputStream(file), MInformation.TEXT_ENCODING));
+            buffer = new LineNumberReader(new InputStreamReader(new FileInputStream(file), MConstants.TEXT_ENCODING));
         }
         catch (FileNotFoundException exception) {
             throw new MTranslationFileParsingException("Could not open file.", exception);