1 57 58 59 package org.enhydra.apache.xml.serialize; 60 61 import java.io.OutputStream ; 62 import java.io.OutputStreamWriter ; 63 import java.io.UnsupportedEncodingException ; 64 import java.io.Writer ; 65 66 71 public class EncodingInfo { 72 73 String name; 74 String javaName; 75 int lastPrintable; 76 77 80 public EncodingInfo(String mimeName, String javaName, int lastPrintable) { 81 this.name = mimeName; 82 this.javaName = javaName == null ? mimeName : javaName; 83 this.lastPrintable = lastPrintable; 84 } 85 86 89 public EncodingInfo(String mimeName, int lastPrintable) { 90 this(mimeName, mimeName, lastPrintable); 91 } 92 93 96 public String getName() { 97 return this.name; 98 } 99 100 108 public Writer getWriter(OutputStream output) 109 throws UnsupportedEncodingException { 110 if (this.javaName == null) 111 return new OutputStreamWriter (output); 112 return new OutputStreamWriter (output, this.javaName); 113 } 114 119 public boolean isPrintable(int ch) { 120 return ch <= this.lastPrintable; 121 } 122 } 123 | Popular Tags |