当前位置: 首页>>代码示例>>Java>>正文


Java UTF8类代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.charsets.UTF8的典型用法代码示例。如果您正苦于以下问题:Java UTF8类的具体用法?Java UTF8怎么用?Java UTF8使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UTF8类属于edu.umd.cs.findbugs.charsets包,在下文中一共展示了UTF8类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleXArgs

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
/**
 * Handle -xargs command line option by reading jar file names from standard
 * input and adding them to the project.
 *
 * @throws IOException
 */
public void handleXArgs() throws IOException {
    if (getXargs()) {
        BufferedReader in = UTF8.bufferedReader(System.in);
        try {
        while (true) {
            String s = in.readLine();
            if (s == null)
                break;
            project.addFile(s);
        }
        } finally {
         Util.closeSilently(in);
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:22,代码来源:TextUICommandLine.java

示例2: addCollection

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
private void addCollection(List<Document> messageCollectionList, String filename) throws PluginException {
    URL messageURL = getResource(filename);
    if (messageURL != null) {
        SAXReader reader = new SAXReader();
        try {
            Reader stream = UTF8.bufferedReader(messageURL.openStream());
            Document messageCollection;
            try {
                messageCollection = reader.read(stream);
            } finally {
                stream.close();
            }
            messageCollectionList.add(messageCollection);
        } catch (Exception e) {
            throw new PluginException("Couldn't parse \"" + messageURL + "\"", e);
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:19,代码来源:PluginLoader.java

示例3: main

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
public static void main(String[] args) throws IOException, DocumentException {
    FindBugs.setNoAnalysis();
    DetectorFactoryCollection.instance();
    ListBugDatabaseInfoCommandLine commandLine = new ListBugDatabaseInfoCommandLine();
    int argCount = commandLine.parse(args, 0, Integer.MAX_VALUE, USAGE);

    PrintWriter out = UTF8.printWriter(System.out, true);
    if (argCount == args.length)
        listVersion(out, null, commandLine.formatDates);
    else {
        out.println("version\ttime\tclasses\tNCSS\terrors\ttotal\thigh\tmedium\tlow\tfile");
        while (argCount < args.length) {
            String fileName = args[argCount++];
            listVersion(out, fileName, commandLine.formatDates);
        }
    }
    out.close();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:19,代码来源:ListBugDatabaseInfo.java

示例4: main

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    DetectorFactoryCollection.instance(); // load plugins

    Churn churn = new Churn();
    ChurnCommandLine commandLine = churn.new ChurnCommandLine();
    int argCount = commandLine
            .parse(args, 0, 2, "Usage: " + Churn.class.getName() + " [options] [<xml results> [<history]] ");

    SortedBugCollection bugCollection = new SortedBugCollection();
    if (argCount < args.length)
        bugCollection.readXML(args[argCount++]);
    else
        bugCollection.readXML(System.in);
    churn.setBugCollection(bugCollection);
    churn.execute();
    PrintStream out = System.out;
    try {
        if (argCount < args.length) {
            out = UTF8.printStream(new FileOutputStream(args[argCount++]), true);
        }
        churn.dump(out);
    } finally {
        out.close();
    }

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:27,代码来源:Churn.java

示例5: main

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
public static void main(String[] argv) throws Exception {

        FindBugs.setNoAnalysis();
        final CSPoptions options = new CSPoptions();
        final CSRCommandLine commandLine = new CSRCommandLine(options);
        int argCount = commandLine.parse(argv, 0, 1, "Usage: " + CloudSyncAndReport.class.getName()
                + " [options] [<results1> <results2> ... <resultsn>] ");

        if (argCount < argv.length)
            options.analysisFile = argv[argCount];

        CloudSyncAndReport csr = new CloudSyncAndReport(options);
        csr.load();

        csr.sync();
        PrintWriter out = UTF8.printWriter(System.out);
        csr.report(out);
        out.flush();
        csr.shutdown();
        out.close();
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:22,代码来源:CloudSyncAndReport.java

示例6: checkAuthorized

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
private boolean checkAuthorized(URL response) throws IOException {
    HttpURLConnection connection = (HttpURLConnection) response.openConnection();

    int responseCode = connection.getResponseCode();
    if (responseCode == 200) {
        InputStream in = connection.getInputStream();
        BufferedReader reader = UTF8.bufferedReader(in);
        try {
            String status = reader.readLine();
            sessionId = Long.parseLong(reader.readLine());
            username = reader.readLine();
            Util.closeSilently(reader);
            if ("OK".equals(status)) {
                LOGGER.info("Authorized session " + sessionId);
                return true;
            }
        } finally {
            reader.close();
        }

    }
    connection.disconnect();
    return false;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:25,代码来源:WebCloudNameLookup.java

示例7: getAnalysisOptionProperties

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
public static ArrayList<String> getAnalysisOptionProperties(boolean ignoreComments, boolean ignoreBlankLines) {
    ArrayList<String> resultList = new ArrayList<String>();
    URL u = DetectorFactoryCollection.getCoreResource("analysisOptions.properties");
    if (u != null) {
        BufferedReader reader = null;
        try {
            reader = UTF8.bufferedReader(u.openStream());
            addCommandLineOptions(resultList, reader, ignoreComments, ignoreBlankLines);
        } catch (IOException e) {
            AnalysisContext.logError("unable to load analysisOptions.properties", e);
        } finally {
            Util.closeSilently(reader);
        }
    }
    return resultList;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:17,代码来源:CommandLine.java

示例8: xslt

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
public static void xslt(String stylesheet, boolean applySuppression, String[] args, int argCount) throws Exception {
    Project proj = new Project();
    HTMLBugReporter reporter = new HTMLBugReporter(proj, stylesheet);
    BugCollection bugCollection = reporter.getBugCollection();

    bugCollection.setApplySuppressions(applySuppression);
    if (argCount < args.length) {
        bugCollection.readXML(args[argCount++]);
    } else
        bugCollection.readXML(System.in);

    if (argCount < args.length)
        reporter.setOutputStream(UTF8.printStream(new FileOutputStream(args[argCount++]), true));

    reporter.finish();
    Exception e = reporter.getFatalException();
    if (e != null)
        throw e;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:20,代码来源:PrintingBugReporter.java

示例9: ProjectPackagePrefixes

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
public ProjectPackagePrefixes() {
    URL u = DetectorFactoryCollection.getCoreResource("projectPaths.properties");
    if (u != null) {

        BufferedReader in = null;
        try {
             in = UTF8.bufferedReader(u.openStream());
            while (true) {
                String s = in.readLine();
                if (s == null)
                    break;
                String[] parts = s.split("=");
                if (parts.length == 2 && !map.containsKey(parts[0]))
                    map.put(parts[0], new PrefixFilter(parts[1]));
            }
        } catch (IOException e1) {

            AnalysisContext.logError("Error loading projects paths", e1);
        } finally {
           Util.closeSilently(in);
        }

    }

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:26,代码来源:ProjectPackagePrefixes.java

示例10: visit

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
@Override
public void visit(Code code) {
    primer = UTF8.getBytes(getFullyQualifiedMethodName());

    super.visit(code); // make callbacks to sawOpcode for all opcodes
    accumulator.reportAccumulatedBugs();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:8,代码来源:Noise.java

示例11: parseDocument

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
private static Document parseDocument(@WillClose InputStream in) throws DocumentException {
    Reader r = UTF8.bufferedReader(in);
    try {
        SAXReader reader = new SAXReader();
        Document d = reader.read(r);
        return d;
    } finally {
        Util.closeSilently(r);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:PluginLoader.java

示例12: write

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
/**
 * Save the project to an output file.
 *
 * @param outputFile
 *            name of output file
 * @param useRelativePaths
 *            true if the project should be written using only relative
 *            paths
 * @param relativeBase
 *            if useRelativePaths is true, this file is taken as the base
 *            directory in terms of which all files should be made relative
 * @throws IOException
 *             if an error occurs while writing
 */
@Deprecated
public void write(String outputFile, boolean useRelativePaths, String relativeBase) throws IOException {
    PrintWriter writer = UTF8.printWriter(outputFile);
    try {
        writer.println(JAR_FILES_KEY);
        for (String jarFile : analysisTargets) {
            if (useRelativePaths) {
                jarFile = convertToRelative(jarFile, relativeBase);
            }
            writer.println(jarFile);
        }

        writer.println(SRC_DIRS_KEY);
        for (String srcDir : srcDirList) {
            if (useRelativePaths) {
                srcDir = convertToRelative(srcDir, relativeBase);
            }
            writer.println(srcDir);
        }

        writer.println(AUX_CLASSPATH_ENTRIES_KEY);
        for (String auxClasspathEntry : auxClasspathEntryList) {
            if (useRelativePaths) {
                auxClasspathEntry = convertToRelative(auxClasspathEntry, relativeBase);
            }
            writer.println(auxClasspathEntry);
        }

        if (useRelativePaths) {
            writer.println(OPTIONS_KEY);
            writer.println(RELATIVE_PATHS + "=true");
        }
    } finally {
        writer.close();
    }

    // Project successfully saved
    isModified = false;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:54,代码来源:Project.java

示例13: getHash

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
public @CheckForNull
String getHash(String sourceFile) {
    StringBuilder rawHash = hashes.get(sourceFile);
    if (rawHash == null || digest == null)
        return null;
    byte[] data = digest.digest(UTF8.getBytes(rawHash.toString()));
    String tmp = new BigInteger(1, data).toString(16);
    if (tmp.length() < 32)
        tmp = "000000000000000000000000000000000".substring(0, 32 - tmp.length()) + tmp;
    return tmp;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:12,代码来源:FileBugHash.java

示例14: main

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    FindBugs.setNoAnalysis();
    DetectorFactoryCollection.instance(); // load plugins

    MineBugHistory mineBugHistory = new MineBugHistory();
    MineBugHistoryCommandLine commandLine = mineBugHistory.new MineBugHistoryCommandLine();
    int argCount = commandLine.parse(args, 0, 2, "Usage: " + MineBugHistory.class.getName()
            + " [options] [<xml results> [<history]] ");

    SortedBugCollection bugCollection = new SortedBugCollection();
    if (argCount < args.length)
        bugCollection.readXML(args[argCount++]);
    else
        bugCollection.readXML(System.in);
    mineBugHistory.setBugCollection(bugCollection);

    mineBugHistory.execute();
    PrintStream out = System.out;

    try {
        if (argCount < args.length) {
            out = UTF8.printStream(new FileOutputStream(args[argCount++]), true);
        }
        mineBugHistory.dump(out);
    } finally {
        out.close();
    }

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:30,代码来源:MineBugHistory.java

示例15: load

import edu.umd.cs.findbugs.charsets.UTF8; //导入依赖的package包/类
public void load() throws IOException, DocumentException {
    if (options.analysisFile == null)
        bugCollection.readXML(UTF8.bufferedReader(System.in));
    else
        bugCollection.readXML(options.analysisFile);
    if (options.cloudId != null && !options.cloudId.equals(bugCollection.getProject().getCloudId())) {
        bugCollection.getProject().setCloudId(options.cloudId);
        bugCollection.reinitializeCloud();
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:CloudSyncAndReport.java


注:本文中的edu.umd.cs.findbugs.charsets.UTF8类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。