public List < ElementSpec > read ( DocumentSource docSource , CSSBoxAnalyzer cba , Dimension dim ) throws IOException { // ale ked sa pouzije setText() neviem nic o url, nic sa nenastavuje , // moze byt null // (URL) doc.getProperty(Document.StreamDescriptionProperty) if ( cba == null ) throw new IllegalArgumentException ( "CSSBoxAnalyzer can not be NULL !!!\nProvide your custom implementation or check instantiation of DefaultAnalyzer object..." ) ; elements = new Vector < ElementSpec > ( ) ; // ArrayList<ElementSpec>(1024); elements . add ( new ElementSpec ( SimpleAttributeSet . EMPTY , ElementSpec . EndTagType ) ) ; order = 0 ; // System.err.print("used Reader and encoding ? " + // is.getCharacterStream() + " , "); // InputStreamReader r = (InputStreamReader)is.getCharacterStream(); // System.err.println(r.getEncoding()); Viewport vp ; try { // System.err.println("analyzing..."); vp = cba . analyze ( docSource , dim ) ; // System.err.println("analyzing finished..."); } catch ( Exception e ) { throw new IOException ( e ) ; } //Use this for "drawing" the boxes. This constructs the element list. vp . draw ( this ) ; // System.err.println("num. of elements : " + elements.size()); // System.err.println("Root min width : " + root.getMinimalWidth() + // " ,normal width : " + root.getWidth() + " ,maximal width : " + // root.getMaximalWidth()); // TODO po skonceni nacitavania aj nejake info spravit // >> Document.TitleProperty - observer, metainfo return elements ; }
Reads input data and converts them to elements