Find the class online, speed up access to Android Docs API, the main reason is to load the JS file on the internet slow, and another is to load Google fonts slow!
Import Java.io.bufferedreader;import java.io.bufferedwriter;import Java.io.file;import Java.io.FileFilter;import Java.io.filenotfoundexception;import Java.io.filereader;import Java.io.filewriter;import java.io.IOException; Import Java.util.map;import Java.util.UUID; public class Androiddoc {private static final String Android_sdk_home = "Android_sdk_home"; private static final String TAG = "<script src=\" http://www.google.com/jsapi\ "type=\" text/javascript\ "></ Script> "; private static final String TAG = "<link rel=\" stylesheet\ ""; private static final String TAG = "Href=\" Http://fonts.googleapis.com/css?family=Roboto:regular,medium,thin,italic , mediumitalic,bold\ "title=\" roboto\ ">"; private static String androidsdkhome; public static void Main (string[] args) {map<string, string> Map = system.getenv (); Androidsdkhome = Map.get (android_sdk_home); if (androidsdkhome! = null) {System.out.printlN ("detected the Android SDK installation path:" + androidsdkhome); File docs = new file (androidsdkhome + "\\docs"); System.out.println ("It'll take several minutes, please wait ..."); Traverse (docs); System.out. println ("Operation Down!!! Now you can visit Android Doc without waiting ... "); } else {System.out. println ("Please configure the Android SDK environment variable (android _sdk_home) ");}} /** * Traverse the Docs directory under the Android SDK installation directory * * @param dir */private static void Traverse (File dir) {if (d Ir.isdirectory ()) {file[] files = dir.listfiles (new FileFilter () {@Override PU Blic Boolean Accept (file file) {if (File.isfile () && file.getname (). EndsWith (". html")) { BufferedReader reader = null; try { reader = new BufferedReader (new FileReader (file)); String buffer; while ((buffer = Reader.readline ()) = null) {if (Buffer.trim (). Equalsignorecase (TAG)) { return true; }}} catch (Exception e) {E.printstacktrace (); } finally {try {reader.close (); } catch (IOException e) {e.printstacktrace (); }}} and Else if (File.isdirectory ()) {return true; } return false; } }); for (File file:files) {if (File.isdirectory ()) {SystEm.out.println ("Scanning Folder:" + File.getabsolutepath ()); Traverse (file); } else {dochange (file); }}}}/** * comment in HTML for a line of javascript code * * @param file * @return */private Static Boolean dochange (file file) {System.out.println ("Extracting file:" + file.getabsolutepath () + "..."); String Despath = file.getparent () + "\ \" + Uuid.randomuuid (). toString () + ". html"; File des = new file (Despath); BufferedReader reader = null; BufferedWriter writer = null; try {des.createnewfile (); reader = new BufferedReader (new FileReader (file)); writer = new BufferedWriter (new FileWriter (DES)); String buffer; while ((buffer = Reader.readline ()) = null) {if (Buffer.trim (). Equalsignorecase (TAG)) { Buffer = "<!--" + TAG + "-"; } writer.write (buffer + "\ n"); Writer.flush (); } return true; } catch (FileNotFoundException e) {e.printstacktrace (); } catch (IOException e) {e.printstacktrace (); } finally {try {reader.close (); Writer.close (); File.delete (); Des.renameto (file); } catch (IOException e) {e.printstacktrace (); }} return false; } }
Direct compilation run, three lines of comments, three rows for replacement three times
There are two reasons why loading Google's fonts, two is loading Google's JS file.
If you feel trouble go directly to my disk download, address: http://pan.baidu.com/s/1eQd4gEm