Package de.java2html.javasource

Examples of de.java2html.javasource.JavaSourceParser


      JavaSource jsource = null;
      try {
        String className = clazz.getCanonicalName();
        className = className.replace('.', '/');
        String sourcePath = WebappHelper.getSourcePath()+"/"+className +".java";
        jsource = new JavaSourceParser().parse(new File(sourcePath));
      } catch (IOException e) {
        showInfo("todo");
      }
 
      //Create a converter and write the JavaSource object as Html
View Full Code Here


      file = new File(javaSourcePath);
    }
    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>");
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);
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();
View Full Code Here

     * @return the source as an HTML string
     * @throws IOException
     *             if the source code could not be read
     */
    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();
View Full Code Here

TOP

Related Classes of de.java2html.javasource.JavaSourceParser

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.