国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

android幫助文檔打開慢的三種解決方法

2020-02-21 17:35:52
字體:
來源:轉載
供稿:網友

雖然android sdk中的離線文檔都是本地文件,但是有很多javascript和css需要連接到服務器,這使得打開的速度非常慢,下文是武林技術頻道小編為您整理的android幫助文檔打開慢的三種解決方法,一起進入下文了解一下吧!

復制代碼 代碼如下:


用一下java代碼就可以批量注釋

?

?

復制代碼 代碼如下:

package cn.sd.fxd.android;

?

/*
?* 去掉Android文檔中需要聯網的javascript代碼
?*/
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FormatDoc {
??? public static int j=1;
??? /**
???? * @param args
???? */
??? public static void main(String[] args) {

??????? File file = new File("D:/android/android-sdk-windows/docs/");
??????? searchDirectory(file, 0);
??????? System.out.println("OVER");
??? }

??? public static void searchDirectory(File f, int depth) {
??????? if (!f.isDirectory()) {
??????????? String fileName = f.getName();
??????????? if (fileName.matches(".*?.html")) {
??????????????? String src = "";
??????????????? String dst = "";
??????????????? //如果是html文件則注釋掉其中的特定javascript代碼
??????????????? annotation(f, src, dst);
??????????? }
??????? } else {
??????????? File[] fs = f.listFiles();
??????????? depth++;
??????????? for (int i = 0; i < fs.length; ++i) {
??????????????? File file = fs[i];
??????????????? searchDirectory(file, depth);
??????????? }
??????? }
??? }

??? /*
???? * f 將要修改其中特定內容的文件
???? * src 將被替換的內容
???? * dst 將被替換層的內容
???? */
??? public static void annotation(File f, String src, String dst) {
??????? String content = FormatDoc.read(f);
??????? content = content.replaceAll(src, dst);
??????? FormatDoc.write(content, f);
??????? System.out.println(j++);
??????? return;

??? }

??? public static String read(File src) {
??????? StringBuffer res = new StringBuffer();
??????? String line = null;
??????? try {
??????????? BufferedReader reader = new BufferedReader(new FileReader(src));
??????????? int i=0;
??????????? while ((line = reader.readLine()) != null) {
??????????????? if (i!=0) {
??????????????????? res.append('/n');
??????????????? }
??????????????? res.append(line);
??????????????? i++;
??????????? }
??????????? reader.close();
??????? } catch (FileNotFoundException e) {
??????????? e.printStackTrace();
??????? } catch (IOException e) {
??????????? e.printStackTrace();
??????? }
??????? return res.toString();
??? }

??? public static boolean write(String cont, File dist) {
??????? try {
??????????? BufferedWriter writer = new BufferedWriter(new FileWriter(dist));
??????????? writer.write(cont);
??????????? writer.flush();
??????????? writer.close();
??????????? return true;
??????? } catch (IOException e) {
??????????? e.printStackTrace();
??????????? return false;
??????? }
??? }
}


網上有種方法是通過shell刪除那行js代碼,非常簡潔方便,比我寫的java方便100倍,I HATE JAVA

?

?

復制代碼 代碼如下:

find . -name "*.html"|xargs grep -l "jsapi"|xargs sed -i '/jsapi/d'


還有的方法是斷網,或者用IE,firefox脫機瀏覽

以上是武林技術頻道小編為大家搜集的android幫助文檔打開慢的三種解決方法,希望對大家的學習有一定的幫助!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 镇安县| 香港| 鹤峰县| 邯郸市| 丰都县| 广德县| 赫章县| 清镇市| 依兰县| 长岛县| 鞍山市| 慈利县| 大冶市| 包头市| 潞城市| 同江市| 余江县| 革吉县| 莱西市| 泸州市| 奎屯市| 柳林县| 阿巴嘎旗| 井冈山市| 长沙市| 郴州市| 佳木斯市| 综艺| 宁晋县| 金平| 咸宁市| 岳普湖县| 嘉荫县| 喀喇沁旗| 兰溪市| 江川县| 孟村| 东丽区| 盘山县| 奉化市| 高邑县|