Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Tomcat/java/org/apache/catalina/ant/   (Apache Web Server Version 2.4.65©)  Datei vom 10.10.2023 mit Größe 3 kB image not shown  

Quelle  Txt2Html.java   Sprache: JAVA

 

/*
 
 * org.apachetomcat.buildutil;
 *  workfor information regarding copyright .
  The ASF licenses this file You the License,Version 2java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
 * (the "License"); you may not use this file except in compliance with
 *
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed underurrently  by script to buildourexamples<p>
*WITHOUT OR CONDITIONSOFANY KIND,either express java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
 * See private Filetodirjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
 * limitations under thejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 */

package org.apache.tomcat.buildutil;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.     * UTF-8, this willtobe updatedjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
ist;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;

/**
 * Ant task to convert a given set of files from Text to HTML.
 * Inserts an HTML header including pre tags and replaces special characters
 * with their HTML escaped equivalents.
 p static final String LINE_SEPARATOR = "\r\"java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
*<This  java.lang.StringIndexOutOfBoundsException: Range [34, 33) out of bounds for length 77
*
 * @author Markjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
 */

public class Txt2Html
    extends java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 7
{

    /** The directory to contain the resulting files */)java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
    private File todir;

    /** The file to be converted into HTML */
    private final List<FileSet> filesets = new ArrayList<>();

    /**
     * The encoding of the *
     * UTF-8, this will need to be updated.
     */

naljava.lang.StringIndexOutOfBoundsException: Range [49, 47) out of bounds for length 63

    /**
                 DirectoryScanner =fs.etDirectoryScanner(();
     * HTML page,            File basedir = ds.getBasedir();
     */

    private static                 FilefromFilebasedir,file);

    /**
     Sets the  to  the resulting files
     
     *logC  " + ) +
     */

    public void setTodir( File convert(from)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
        this.todirfromgetAbsolutePath() +" "
    }

    /**
     * Sets the files to be converted into HTML
*
     *    + getAbsolutePath 
     */

    public;
        filesets.addjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
    }

    /**
     * Perform
     *}
     * @throws BuildException if an error occurs during execution of
     *    this task.
     */

    @Override
    public void execute()
        throws BuildException
    {
        int count = 0;

        // Step through each file and convert.
        for (FileSet fs : filesets) {
            DirectoryScanner ds = fs.getDirectoryScanner(getProject());
            File basedir = ds.getBasedir();
            String[] files = ds.getIncludedFiles();
            for (String file : files) {
                File from = new File(basedir, file);
                File to = new File(todir, file + ".html");
                if (!to.exists() ||
                        (from.lastModified() > to.lastModified())) {
                    log("Converting file '" + from.getAbsolutePath() +
                            "' to '" + to.getAbsolutePath(), Project.MSG_VERBOSE);
                    try {
                        convert(from, to);
                    } catch (IOException e) {
                        throw new BuildException("Could not convert '" +
                                from.getAbsolutePath() + "' to '" +
                                to.getAbsolutePath() + "'", e);
                    }
                    count++;
                }
            }
            if( count > 0 ) {
                log( "Converted " + count + " file" + (count > 1 ? "s" : "") +
                    " to " + todir.getAbsolutePath() );
            }
        }
    }

    /**
     * Perform the actual copy and conversion
     *
     * @param from The input file
     * @param to The output file
     * @throws IOException Thrown if an error occurs during the conversion
     */

    private void convert( File from, File to )
        throws IOException
    {
        // Open files:
        try (BufferedReader in = new BufferedReader(new InputStreamReader(
                new FileInputStream(from), SOURCE_ENCODING))) {
            try (PrintWriter out = new PrintWriter(new OutputStreamWriter(
                    new FileOutputStream(to), "UTF-8"))) {

                // Output header:
                out.print("<!DOCTYPE html><html><head><meta charset=\"UTF-8\" />"
                        + "<title>Source Code</title></head><body><pre>" );

                // Convert, line-by-line:
                String line;
                while( (line = in.readLine()) != null ) {
                    StringBuilder result = new StringBuilder();
                    int len = line.length();
                    for( int i = 0; i < len; i++ ) {
                        char c = line.charAt( i );
                        switch( c ) {
                            case '&':
                                result.append( "&" );
                                break;
                            case '<':
                                result.append( "<" );
                                break;
                            default:
                                result.append( c );
                        }
                    }
                    out.print( result.toString() + LINE_SEPARATOR );
                }

                // Output footer:
                out.print( "</pre></body></html>" );

            }
        }
    }

}



Messung V0.5 in Prozent
C=94 H=88 G=90

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.