String readHTMLDocumentation ( InputStream input , FileObject filename ) throws IOException { byte [ ] filecontents = new byte [ input . available ( ) ] ; try { DataInputStream dataIn = new DataInputStream ( input ) ; dataIn . readFully ( filecontents ) ; } finally { input . close ( ) ; } String encoding = env . getEncoding ( ) ; String rawDoc = ( encoding != null ) ? new String ( filecontents , encoding ) : new String ( filecontents ) ; Pattern bodyPat = Pattern . compile ( "(?is).*<body\\b[^>]*>(.*)</body\\b.*" ) ; Matcher m = bodyPat . matcher ( rawDoc ) ; if ( m . matches ( ) ) { return m . group ( 1 ) ; } else { String key = rawDoc . matches ( "(?is).*<body\\b.*" ) ? "javadoc.End_body_missing_from_html_file" : "javadoc.Body_missing_from_html_file" ; env . error ( SourcePositionImpl . make ( filename , Position . NOPOS , null ) , key ) ; return "" ; } }
Utility for subclasses which read HTML documentation files .