1 28 29 package com.caucho.vfs; 30 31 import com.caucho.util.CharBuffer; 32 33 import java.io.IOException ; 34 35 50 public class ByteToChar extends AbstractByteToChar { 51 private CharBuffer _charBuffer; 52 53 56 ByteToChar() 57 { 58 _charBuffer = new CharBuffer(); 59 } 60 61 public static ByteToChar create() 62 { 63 return new ByteToChar(); 64 } 65 66 69 public void clear() 70 { 71 super.clear(); 72 73 _charBuffer.clear(); 74 } 75 76 79 public String getConvertedString() 80 throws IOException 81 { 82 flush(); 83 84 return _charBuffer.toString(); 85 } 86 87 protected void outputChar(int ch) 88 { 89 _charBuffer.append((char) ch); 90 } 91 92 95 public String toString() 96 { 97 try { 98 return getConvertedString(); 99 } catch (IOException e) { 100 throw new RuntimeException (String.valueOf(e)); 101 } 102 } 103 } 104 | Popular Tags |