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

📄 weblog.java

📁 JSON(javascript) object creator and examples
💻 JAVA
字号:
import java.net.*;import java.io.*;class weblog {  public static void main(String args[]) {    String thisLine;    String thisIP;    String theRest;    int index;    InetAddress thisAddress;    byte[] address;    try {      FileInputStream fin =  new FileInputStream(args[0]);      DataInputStream myInput = new DataInputStream(fin);        while ((thisLine = myInput.readLine()) != null) {          index = thisLine.indexOf(" ", 0);          thisIP = thisLine.substring(0, index);          theRest = thisLine.substring(index, thisLine.length());          try {            thisAddress = InetAddress.getByName(thisIP);            address = thisAddress.getAddress();            System.out.println(InetAddressFactory.newInetAddress(address).getHostName() + theRest);          }          catch (UnknownHostException e) {            System.out.println(thisLine);          }       } // while loop ends here    }    catch (IOException e) {      System.out.println("Exception: " + e);    }  }  // end main}

⌨️ 快捷键说明

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