1 17 18 22 23 package org.apache.geronimo.system.configuration; 24 25 import java.io.OutputStream ; 26 import java.io.OutputStreamWriter ; 27 import java.io.UnsupportedEncodingException ; 28 import java.io.Writer ; 29 30 35 public class EncodingInfo { 36 37 String name; 38 String javaName; 39 int lastPrintable; 40 41 44 public EncodingInfo(String mimeName, String javaName, int lastPrintable) { 45 this.name = mimeName; 46 this.javaName = javaName == null ? mimeName : javaName; 47 this.lastPrintable = lastPrintable; 48 } 49 50 53 public EncodingInfo(String mimeName, int lastPrintable) { 54 this(mimeName, mimeName, lastPrintable); 55 } 56 57 60 public String getName() { 61 return this.name; 62 } 63 64 72 public Writer getWriter(OutputStream output) 73 throws UnsupportedEncodingException { 74 if (this.javaName == null) 75 return new OutputStreamWriter (output); 76 return new OutputStreamWriter (output, this.javaName); 77 } 78 83 public boolean isPrintable(int ch) { 84 return ch <= this.lastPrintable; 85 } 86 } 87 | Popular Tags |