1 23 package org.archive.util.ms; 24 25 26 import java.io.UnsupportedEncodingException ; 27 28 29 38 public class Cp1252 { 39 40 41 46 final private static char[] XLAT = createTable(); 47 48 49 52 private Cp1252() { 53 } 54 55 56 62 private static char[] createTable() { 63 char[] result = new char[256]; 64 byte[] b = new byte[1]; 65 for (int i = 0; i < 256; i++) try { 66 b[0] = (byte)i; 67 String s = new String (b, "Cp1252"); 68 result[i] = s.charAt(0); 69 } catch (UnsupportedEncodingException e) { 70 throw new RuntimeException (e); 71 } 72 return result; 73 } 74 75 76 82 public static char decode(int b) { 83 return XLAT[b]; 84 } 85 86 87 } 88 | Popular Tags |