01: // PageCompileutStream.java
02: // $Id: PageCompileOutputStream.java,v 1.3 2000/08/16 21:37:43 ylafon Exp $
03: // (c) COPYRIGHT MIT and INRIA, 1998.
04: // Please first read the full copyright statement in file COPYRIGHT.html
05:
06: package org.w3c.jigsaw.pagecompile;
07:
08: import java.io.ByteArrayInputStream;
09: import java.io.ByteArrayOutputStream;
10: import java.io.IOException;
11: import java.io.InputStream;
12: import java.io.OutputStream;
13:
14: /**
15: * @version $Revision: 1.3 $
16: * @author Benoît Mahé (bmahe@w3.org)
17: */
18: public class PageCompileOutputStream extends ByteArrayOutputStream {
19:
20: public void writeBytes(String s) throws IOException {
21: write(s.getBytes());
22: }
23:
24: public void print(int i) throws IOException {
25: writeBytes(Integer.toString(i));
26: }
27:
28: public void print(double i) throws IOException {
29: writeBytes(Double.toString(i));
30: }
31:
32: public void print(long l) throws IOException {
33: writeBytes(Long.toString(l));
34: }
35:
36: public void print(String s) throws IOException {
37: writeBytes(s);
38: }
39:
40: public void println() throws IOException {
41: writeBytes("\r\n");
42: }
43:
44: public void println(int i) throws IOException {
45: print(i);
46: println();
47: }
48:
49: public void println(double i) throws IOException {
50: print(i);
51: println();
52: }
53:
54: public void println(long l) throws IOException {
55: print(l);
56: println();
57: }
58:
59: public void println(String s) throws IOException {
60: print(s);
61: println();
62: }
63:
64: InputStream getInputStream() {
65: return new ByteArrayInputStream(toByteArray(), 0, size());
66: }
67:
68: }
|