Package de.java2html.converter

Examples of de.java2html.converter.JavaSource2HTMLConverter


      } catch (IOException e) {
        showInfo("todo");
      }
 
      //Create a converter and write the JavaSource object as Html
      JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter();
      StringWriter writer = new StringWriter();
      writer.append(HTML_START);
      try {
         JavaSourceConversionOptions options = JavaSourceConversionOptions.getDefault();
         options.setShowLineNumbers(true);
        converter.convert(jsource, options, writer);
      } catch (IOException e) {
        //
      }
      StringMediaResource mr = new StringMediaResource();
      mr.setContentType(TEXT_HTML_CHARSET_UTF_8);
View Full Code Here


    StringWriter writer = new StringWriter();
    writer.append(HTML_START);
    if (file.exists()) {
      jsource = new JavaSourceParser().parse(file);
      //Create a converter and write the JavaSource object as Html
      JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter();
      converter.convert(jsource, JavaSourceConversionOptions.getDefault(), writer);
    } else {
      writer.append("<html><body><h3>The source file could not be found in the following path:<br>"+javaSourcePath+"<br>Check if configured source path in brasatoconfig.xml is correct.</h3></body></html>");
    }
   
    StringMediaResource mr = new StringMediaResource();
View Full Code Here

     * @return the duplicate source code fragment
     */
    public String getFormattedSourceCode() {
        try {
            JavaSource source = new JavaSourceParser().parse(new StringReader(sourceCode));
            JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter();
            StringWriter writer = new StringWriter();
            JavaSourceConversionOptions options = JavaSourceConversionOptions.getDefault();
            options.setShowLineNumbers(false);
            options.setAddLineAnchors(false);
            converter.convert(source, options, writer);

            return writer.toString();
        }
        catch (IllegalConfigurationException exception) {
            return sourceCode;
View Full Code Here

            inputStream = classLoader.getResourceAsStream(fileName);
            if (inputStream == null) return "Unable to load file: " + fileName;

            final StringWriter writer = new StringWriter();
            final JavaSource javaSource = new JavaSourceParser().parse(inputStream);
            final JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter();
            converter.convert(javaSource, JavaSourceConversionOptions.getDefault(), writer);

            return writer.toString();

        } catch (final IOException e) {
            log.error("", e);
View Full Code Here

     */
    public final String highlightSource(final InputStream file) throws IOException {
        JavaSource source = new JavaSourceParser().parse(
                new InputStreamReader(file, EncodingValidator.defaultCharset(defaultEncoding)));

        JavaSource2HTMLConverter converter = new JavaSource2HTMLConverter();
        StringWriter writer = new StringWriter();
        JavaSourceConversionOptions options = JavaSourceConversionOptions.getDefault();
        options.setShowLineNumbers(true);
        options.setAddLineAnchors(true);
        converter.convert(source, options, writer);

        return writer.toString();
    }
View Full Code Here

TOP

Related Classes of de.java2html.converter.JavaSource2HTMLConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.