1 28 29 package com.caucho.vfs.i18n; 30 31 import java.io.IOException ; 32 import java.io.InputStream ; 33 import java.io.Reader ; 34 import java.io.UnsupportedEncodingException ; 35 36 46 abstract public class EncodingReader extends Reader { 47 private String javaEncoding; 48 49 public String getJavaEncoding() 50 { 51 return javaEncoding; 52 } 53 54 public void setJavaEncoding(String encoding) 55 { 56 this.javaEncoding = encoding; 57 } 58 66 public abstract Reader create(InputStream is, String javaEncoding) 67 throws UnsupportedEncodingException ; 68 69 74 public abstract int read() 75 throws IOException ; 76 77 86 public int read(char []cbuf, int off, int len) 87 throws IOException 88 { 89 for (int i = 0; i < len; i++) { 90 int ch = read(); 91 92 if (ch < 0) 93 return len; 94 95 cbuf[off + i] = (char) ch; 96 } 97 98 return len; 99 } 100 101 104 public void close() 105 { 106 } 107 } 108 | Popular Tags |