XSLTranslator.java
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa;
import com.adobe.xfa.ut.ExFull;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
public class XSLTranslator {
private final Transformer transformer;
public XSLTranslator(StreamSource ss) {
try {
TransformerFactory tFactory = TransformerFactory.newInstance();
this.transformer = tFactory.newTransformer(ss);
}
catch (Exception oEx) {
throw new ExFull(oEx);
}
}
public XSLTranslator(InputStream is) {
this(new StreamSource(is));
}
public void process(InputStream iStream, OutputStream oStream) {
try {
OutputStreamWriter oWriter = new OutputStreamWriter(oStream, "UTF-8");
this.process(new StreamSource(iStream), new StreamResult(oWriter));
}
catch (Exception oEx) {
throw new ExFull(oEx);
}
}
public void process(StreamSource oXMLInStream, StreamResult oOutTextStream) {
try {
this.transformer.transform(oXMLInStream, oOutTextStream);
}
catch (Exception oEx) {
throw new ExFull(oEx);
}
}
}