1 28 29 package com.caucho.vfs; 30 31 import com.caucho.util.ByteBuffer; 32 33 import java.io.IOException ; 34 import java.io.UnsupportedEncodingException ; 35 36 51 public final class OldByteToChar extends ByteToChar { 52 private ByteBuffer bb; 53 private String javaEncoding; 54 55 58 OldByteToChar() 59 { 60 bb = new ByteBuffer(); 61 } 62 63 66 public void setEncoding(String encoding) 67 throws UnsupportedEncodingException 68 { 69 javaEncoding = Encoding.getJavaName(encoding); 70 } 71 72 75 public void clear() 76 { 77 bb.clear(); 78 } 79 80 83 public String getConvertedString() 84 throws IOException 85 { 86 return bb.toString(javaEncoding); 87 } 88 89 94 public void addByte(int b) 95 throws IOException 96 { 97 bb.add(b); 98 } 99 100 105 public void addChar(char nextCh) 106 throws IOException 107 { 108 bb.add((byte) nextCh); 110 } 111 112 115 public String toString() 116 { 117 return "[OldByteToChar " + javaEncoding + "]"; 118 } 119 } 120 | Popular Tags |