⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loganalyzer.java

📁 现在在国外大学里最流行的java学习软件,同时还有大量的example,在名为project的文件里.安装好后用bluej打开peoject的例子,可以进行你想要的任何变化.同时可以了解大量的源码
💻 JAVA
字号:
/** * Read web server data and analyse * hourly access patterns. *  * @author David J. Barnes and Michael Kolling. * @version 2006.03.30 */public class LogAnalyzer{    // Where to calculate the hourly access counts.    private int[] hourCounts;    // Use a LogfileReader to access the data.    private LogfileReader reader;    /**     * Create an object to analyze hourly web accesses.     */    public LogAnalyzer()    {         // Create the array object to hold the hourly        // access counts.        hourCounts = new int[24];        // Create the reader to obtain the data.        reader = new LogfileReader();    }    /**     * Analyze the hourly access data from the log file.     */    public void analyzeHourlyData()    {        while(reader.hasMoreEntries()) {            LogEntry entry = reader.nextEntry();            int hour = entry.getHour();            hourCounts[hour]++;        }    }    /**     * Print the hourly counts.     * These should have been set with a prior     * call to analyzeHourlyData.     */    public void printHourlyCounts()    {        System.out.println("Hr: Count");        for(int hour = 0; hour < hourCounts.length; hour++) {            System.out.println(hour + ": " + hourCounts[hour]);        }    }        /**     * Print the lines of data read by the LogfileReader     */    public void printData()    {        reader.printData();    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -