1 package org.simantics.document.linking.report.html;
3 import java.io.BufferedInputStream;
5 import java.io.FileInputStream;
6 import java.io.IOException;
7 import java.io.PrintStream;
10 * Base class for single HTML stream.
12 * @author Marko Luukkainen <marko.luukkainen@vtt.fi>
16 public class HTMLStreamElement implements HTMLElement{
18 protected HTMLStreamElement parent;
20 protected PrintStream os;
22 public HTMLStreamElement(File file) throws Exception{
25 os = new PrintStream(file,"UTF-8");
28 public HTMLStreamElement(HTMLStreamElement parent) throws Exception{
33 private void openStream() throws IOException {
34 file = File.createTempFile("report_content", ".html");
35 os = new PrintStream(file,"UTF-8");
39 protected void copyData(File source, PrintStream dest)throws Exception {
40 BufferedInputStream is = new BufferedInputStream(new FileInputStream(source));
50 public PrintStream getPrintStream() {
55 * Closes the stream and copies the contents to the parent stream.
58 public void close() throws Exception {
62 copyData(file, parent.os);
69 public String getId() {