1 6 7 10 package javax.xml.transform.stream; 11 12 import javax.xml.transform.Result ; 13 14 import java.io.File ; 15 import java.io.OutputStream ; 16 import java.io.Writer ; 17 import java.net.MalformedURLException ; 18 19 25 public class StreamResult implements Result { 26 27 31 public static final String FEATURE = 32 "http://javax.xml.transform.stream.StreamResult/feature"; 33 34 37 public StreamResult() { 38 } 39 40 48 public StreamResult(OutputStream outputStream) { 49 setOutputStream(outputStream); 50 } 51 52 62 public StreamResult(Writer writer) { 63 setWriter(writer); 64 } 65 66 71 public StreamResult(String systemId) { 72 this.systemId = systemId; 73 } 74 75 80 public StreamResult(File f) { 81 setSystemId(f); 82 } 83 84 92 public void setOutputStream(OutputStream outputStream) { 93 this.outputStream = outputStream; 94 } 95 96 102 public OutputStream getOutputStream() { 103 return outputStream; 104 } 105 106 116 public void setWriter(Writer writer) { 117 this.writer = writer; 118 } 119 120 126 public Writer getWriter() { 127 return writer; 128 } 129 130 137 public void setSystemId(String systemId) { 138 this.systemId = systemId; 139 } 140 141 152 public void setSystemId(File f) { 153 154 try { 155 this.systemId = f.toURI().toString(); 157 } catch (java.lang.NoSuchMethodError nme) { 158 try { 160 this.systemId = f.toURL().toString(); 161 } catch (MalformedURLException malformedURLException) { 162 this.systemId = null; 163 throw new RuntimeException ( 164 "javax.xml.transform.stream.StreamResult#setSystemId(File f) with MalformedURLException: " 165 + malformedURLException.toString() 166 ); 167 } 168 } catch (Exception exception) { 169 throw new RuntimeException ( 170 "javax.xml.transform.stream.StreamResult#setSystemId(File f):" 171 + " unexpected Exception: " + exception.toString() 172 ); 173 174 } 175 } 176 177 183 public String getSystemId() { 184 return systemId; 185 } 186 187 191 196 private String systemId; 197 198 201 private OutputStream outputStream; 202 203 206 private Writer writer; 207 } 208 | Popular Tags |