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 TreeReader extends Reader { 36 37 private final StringReader reader; 38 39 42 public TreeReader (TreeDocumentRoot doc) throws IOException { 43 44 reader = new StringReader (Convertors.treeToString (doc)); 45 46 } 47 48 public void close () throws IOException { 49 if (reader == null) throw new IOException (Util.THIS.getString ("EXC_null_reader")); 50 reader.close (); 51 } 52 53 public int read (char[] cbuf, int off, int len) throws IOException { 54 if (reader == null) throw new IOException (Util.THIS.getString ("EXC_null_reader")); 55 return reader.read (cbuf, off, len); 56 } 57 } 58 | Popular Tags |