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


Java UTF8.bufferedReader方法代码示例

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


在下文中一共展示了UTF8.bufferedReader方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: 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

示例5: 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

示例6: 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

示例7: BugRanker

import edu.umd.cs.findbugs.charsets.UTF8; //导入方法依赖的package包/类
/**
 * @param u
 *            may be null. In this case, a default value will be used for
 *            all bugs
 * @throws IOException
 */
BugRanker(@CheckForNull URL u) throws IOException {
    if (u == null) {
        return;
    }
    BufferedReader in = UTF8.bufferedReader(u.openStream());
    try {
        while (true) {
            String s = in.readLine();
            if (s == null)
                break;

            s = s.trim();
            if (s.length() == 0)
                continue;

            String parts[] = s.split(" ");
            String rank = parts[0];
            String kind = parts[1];
            String what = parts[2];
            if (kind.equals("BugPattern"))
                bugPatterns.storeAdjustment(what, rank);
            else if (kind.equals("BugKind"))
                bugKinds.storeAdjustment(what, rank);
            else if (kind.equals("Category"))
                bugCategories.storeAdjustment(what, rank);
            else
                AnalysisContext.logError("Can't parse bug rank " + s);
        }
    } finally {
        Util.closeSilently(in);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:39,代码来源:BugRanker.java

示例8: expandOptionFiles

import edu.umd.cs.findbugs.charsets.UTF8; //导入方法依赖的package包/类
/**
 * Expand option files in given command line. Any token beginning with "@"
 * is assumed to be an option file. Option files contain one command line
 * option per line.
 *
 * @param argv
 *            the original command line
 * @param ignoreComments
 *            ignore comments (lines starting with "#")
 * @param ignoreBlankLines
 *            ignore blank lines
 * @return the expanded command line
 */

public String[] expandOptionFiles(String[] argv, boolean ignoreComments, boolean ignoreBlankLines) throws IOException,
        HelpRequestedException {
    // Add all expanded options at the end of the options list, before the
    // list of
    // jar/zip/class files and directories.
    // At the end of the options to preserve the order of the options (e.g.
    // -adjustPriority
    // must always come after -pluginList).
    int lastOptionIndex = parse(argv, true);
    ArrayList<String> resultList = new ArrayList<String>();
    ArrayList<String> expandedOptionsList = getAnalysisOptionProperties(ignoreComments, ignoreBlankLines);
    for (int i = 0; i < lastOptionIndex; i++) {
        String arg = argv[i];
        if (!arg.startsWith("@")) {
            resultList.add(arg);
            continue;
        }

        BufferedReader reader = null;
        try {
            reader = UTF8.bufferedReader(new FileInputStream(arg.substring(1)));
            addCommandLineOptions(expandedOptionsList, reader, ignoreComments, ignoreBlankLines);
        } finally {
            Util.closeSilently(reader);
        }
    }
    resultList.addAll(expandedOptionsList);
    for (int i = lastOptionIndex; i < argv.length; i++) {
        resultList.add(argv[i]);
    }

    return resultList.toArray(new String[resultList.size()]);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:48,代码来源:CommandLine.java

示例9: processPage

import edu.umd.cs.findbugs.charsets.UTF8; //导入方法依赖的package包/类
/**
 * Process an HTML page to replace certain substitution patterns. Right now,
 * we just expand @[email protected]
 */
@edu.umd.cs.findbugs.annotations.SuppressWarnings("OS_OPEN_STREAM")
private void processPage(javax.swing.JEditorPane pane, String fileName) throws IOException {
    InputStream in = null;
    BufferedReader reader = null;
    try {
        StringBuilder buf = new StringBuilder();

        // Open the file as a stream
        in = getClass().getClassLoader().getResourceAsStream(fileName);
        if (in == null)
            throw new IOException(MessageFormat.format(
                    edu.umd.cs.findbugs.L10N.getLocalString("msg.couldntload_txt", "Couldn't load {0}"),
                    new Object[] { fileName }));
        reader = UTF8.bufferedReader(in);

        // Replace instances of @[email protected] with actual version number

        String line;
        while ((line = reader.readLine()) != null) {
            line = pattern.matcher(line).replaceAll(Version.RELEASE);
            buf.append(line);
            buf.append('\n');
        }

        // Load the page into the editor pane
        String text = buf.toString();
        pane.setContentType("text/html");
        pane.setText(text);
    } finally {
        try {
            if (reader != null)
                reader.close();
            else if (in != null)
                in.close();
        } catch (IOException e) {
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:43,代码来源:AboutDialog.java


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