1 28 29 package com.caucho.vfs.i18n; 30 31 import com.caucho.vfs.OutputStreamWithBuffer; 32 33 import java.io.IOException ; 34 35 39 public class UTF16Writer extends EncodingWriter { 40 private static final UTF16Writer _writer = new UTF16Writer(); 41 42 45 public UTF16Writer() 46 { 47 } 48 49 56 public EncodingWriter create(String javaEncoding) 57 { 58 return _writer; 59 } 60 61 64 public void write(OutputStreamWithBuffer os, char ch) 65 throws IOException 66 { 67 os.write(ch >> 8); 68 os.write(ch); 69 } 70 71 78 public void write(OutputStreamWithBuffer os, char []cbuf, int off, int len) 79 throws IOException 80 { 81 for (int i = 0; i < len; i++) { 82 char ch = cbuf[off + i]; 83 84 os.write(ch >> 8); 85 os.write(ch); 86 } 87 } 88 } 89 | Popular Tags |