1 16 19 package com.sun.org.apache.xml.internal.serializer; 20 21 import java.io.IOException ; 22 import java.io.OutputStream ; 23 import java.io.Writer ; 24 25 26 27 33 public class WriterToASCI extends Writer 34 { 35 36 37 private final OutputStream m_os; 38 39 45 public WriterToASCI(OutputStream os) 46 { 47 m_os = os; 48 } 49 50 61 public void write(char chars[], int start, int length) 62 throws java.io.IOException 63 { 64 65 int n = length+start; 66 67 for (int i = start; i < n; i++) 68 { 69 m_os.write(chars[i]); 70 } 71 } 72 73 84 public void write(int c) throws IOException 85 { 86 m_os.write(c); 87 } 88 89 96 public void write(String s) throws IOException 97 { 98 int n = s.length(); 99 for (int i = 0; i < n; i++) 100 { 101 m_os.write(s.charAt(i)); 102 } 103 } 104 105 114 public void flush() throws java.io.IOException 115 { 116 m_os.flush(); 117 } 118 119 126 public void close() throws java.io.IOException 127 { 128 m_os.close(); 129 } 130 131 137 public OutputStream getOutputStream() 138 { 139 return m_os; 140 } 141 142 } 143 | Popular Tags |