All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.droidsonroids.gradle.localization.Utils.groovy Maven / Gradle / Ivy

There is a newer version: 1.0.19
Show newest version
package pl.droidsonroids.gradle.localization

import java.util.regex.Pattern

class Utils {
    static final int BUFFER_SIZE = 128 * 1024
    private static
    final Pattern TAG_PATTERN = Pattern.compile('<([A-Z][A-Z0-9]*)\\b[^>]*((/?)|(>.*?))', Pattern.CASE_INSENSITIVE | Pattern.DOTALL)
    private static final Pattern CDATA_PATTERN = Pattern.compile('', Pattern.DOTALL)

    static BufferedReader wrapReader(Reader reader) {
        new BufferedReader(reader, BUFFER_SIZE)
    }

    static BufferedInputStream wrapInputStream(InputStream inputStream) {
        new BufferedInputStream(inputStream, BUFFER_SIZE)
    }

    static boolean containsHTML(String text) {
        return TAG_PATTERN.matcher(text).find() || CDATA_PATTERN.matcher(text).find()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy