1 9 package org.w3c.flute.util; 10 11 import java.io.InputStream ; 12 import java.net.URL ; 13 import java.util.Properties ; 14 15 19 public class Encoding { 20 private Encoding() {} 21 22 25 public static String getJavaEncoding(String encoding) { 26 String _result = encodings.getProperty(encoding); 27 if (_result == null) { 28 return encoding; 29 } 30 return _result; 31 } 32 33 static Properties encodings; 34 35 static { 36 encodings = new Properties (); 37 38 try { 39 URL url = Encoding.class.getResource("encoding.properties"); 40 InputStream f = url.openStream(); 41 encodings.load(f); 42 f.close(); 43 } catch (Exception e) { 44 System.err.println(Encoding.class 45 + ": couldn't load encoding properties "); 46 e.printStackTrace(); 47 } 48 } 49 } 50 | Popular Tags |