Torsten: HTML Scanner URI geht nicht

Beitrag lesen

Es kommt keine fehlermeldung,
ich poste mal den code von mir...

public class TestScanner
 {

//  // This method takes a URI which can be either a filename (e.g. file://c:/dir/file.html)
     // or a URL (e.g. http://host.com/page.html) and returns all text in the document.
     public static String getText(String uriStr) {
         final StringBuffer buf = new StringBuffer(1000);

try {
             // Create an HTML document that appends all text to buf
             HTMLDocument doc = new HTMLDocument() {
                 public HTMLEditorKit.ParserCallback getReader(int pos) {
                     return new HTMLEditorKit.ParserCallback() {
                         // This method is whenever text is encountered in the HTML file
                         public void handleText(char[] data, int pos) {
                             buf.append(data);
                             buf.append('\n');
                         }
                     };
                 }
             };

// Create a reader on the HTML content
             URL url = new URI(uriStr).toURL();
             //System.out.println(url);
             //System.out.print(uriStr);
             URLConnection conn = url.openConnection();
             Reader rd = new InputStreamReader(conn.getInputStream());

//Reader rde = new BufferedReader(new FileReader(uriStr));

// Parse the HTML
             EditorKit kit = new HTMLEditorKit();
             kit.read(rde, doc, 0);
         } catch (MalformedURLException e) {
         //} catch (URISyntaxException e) {
         } catch (BadLocationException e) {
         } catch (IOException e) {
         }

// Return the text
         return buf.toString();
     }

public static void main ( String[] args ) throws IOException
   {
   String link = "file://C:/test.html";
   String outfile = getText(link);
   System.out.print(outfile);

}
}

MFg Torsten