1 19 package org.netbeans.tax.io; 20 21 import java.io.*; 22 23 import org.netbeans.tax.TreeDocumentRoot; 24 import org.netbeans.tax.TreeException; 25 import org.netbeans.tax.io.TreeStreamResult; 26 import org.netbeans.tax.io.TreeWriter; 27 28 35 public class TreeInputStream extends InputStream { 36 37 private final ByteArrayInputStream input; 38 39 42 public TreeInputStream (TreeDocumentRoot doc) throws IOException { 43 input = new ByteArrayInputStream (Convertors.treeToByteArray (doc)); 44 } 45 46 public void close () throws IOException { 47 if (input == null) throw new IOException (Util.THIS.getString ("EXC_null_input")); 48 input.close (); 49 } 50 51 public int read () throws IOException { 52 if (input == null) throw new IOException (Util.THIS.getString ("EXC_null_input")); 53 int ch = input.read (); 54 return ch; 55 } 56 } 57 | Popular Tags |