| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,9 @@ | |||
| 1 | 1 | package info.xiaomo.core.constant; | |
| 2 | 2 | ||
| 3 | + /** | ||
| 4 | + * @author qq | ||
| 5 | + */ | ||
| 6 | + | ||
| 3 | 7 | public enum FileConst { | |
| 4 | 8 | /** | |
| 5 | 9 | * JEPG. | |
@@ -219,7 +223,7 @@ public enum FileConst { | |||
| 219 | 223 | * | |
| 220 | 224 | * @param value | |
| 221 | 225 | */ | |
| 222 | - private FileConst(String value) { | ||
| 226 | + FileConst(String value) { | ||
| 223 | 227 | this.value = value; | |
| 224 | 228 | } | |
| 225 | 229 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -511,7 +511,8 @@ public static boolean pathValidate(String path) { | |||
| 511 | 511 | for (String anArraypath : arraypath) { | |
| 512 | 512 | tmppath += "/" + anArraypath; | |
| 513 | 513 | File d = new File(tmppath.substring(1)); | |
| 514 | - if (!d.exists()) { //检查Sub目录是否存在 | ||
| 514 | + //检查Sub目录是否存在 | ||
| 515 | + if (!d.exists()) { | ||
| 515 | 516 | System.out.println(tmppath.substring(1)); | |
| 516 | 517 | if (!d.mkdir()) { | |
| 517 | 518 | return false; | |
@@ -543,7 +544,8 @@ public static boolean genModuleTpl(String path, String modulecontent) throws IOE | |||
| 543 | 544 | return false; | |
| 544 | 545 | } | |
| 545 | 546 | } | |
| 546 | - FileWriter fw = new FileWriter(path); //建立FileWriter对象,并实例化fw | ||
| 547 | + //建立FileWriter对象,并实例化fw | ||
| 548 | + FileWriter fw = new FileWriter(path); | ||
| 547 | 549 | //将字符串写入文件 | |
| 548 | 550 | fw.write(modulecontent); | |
| 549 | 551 | fw.close(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -149,17 +149,20 @@ public static String delHTMLTag(String htmlStr) { | |||
| 149 | 149 | ||
| 150 | 150 | Pattern pScript = Pattern.compile(regexScript, Pattern.CASE_INSENSITIVE); | |
| 151 | 151 | Matcher mScript = pScript.matcher(htmlStr); | |
| 152 | - htmlStr = mScript.replaceAll(""); //过滤script标签 | ||
| 152 | + //过滤script标签 | ||
| 153 | + htmlStr = mScript.replaceAll(""); | ||
| 153 | 154 | ||
| 154 | 155 | Pattern pStyle = Pattern.compile(regexStyle, Pattern.CASE_INSENSITIVE); | |
| 155 | 156 | Matcher mStyle = pStyle.matcher(htmlStr); | |
| 156 | - htmlStr = mStyle.replaceAll(""); //过滤style标签 | ||
| 157 | + //过滤style标签 | ||
| 158 | + htmlStr = mStyle.replaceAll(""); | ||
| 157 | 159 | ||
| 158 | 160 | Pattern pHtml = Pattern.compile(regexHtml, Pattern.CASE_INSENSITIVE); | |
| 159 | 161 | Matcher mHtml = pHtml.matcher(htmlStr); | |
| 160 | - htmlStr = mHtml.replaceAll(""); //过滤html标签 | ||
| 161 | - | ||
| 162 | - return htmlStr.trim(); //返回文本字符串 | ||
| 162 | + //过滤html标签 | ||
| 163 | + htmlStr = mHtml.replaceAll(""); | ||
| 164 | + //返回文本字符串 | ||
| 165 | + return htmlStr.trim(); | ||
| 163 | 166 | } | |
| 164 | 167 | ||
| 165 | 168 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,10 +26,10 @@ | |||
| 26 | 26 | */ | |
| 27 | 27 | public class HttpUtil { | |
| 28 | 28 | ||
| 29 | - private static final String DEFAULT_CHARSET = "UTF-8"; // 默认字符集 | ||
| 29 | + private static final String DEFAULT_CHARSET = "UTF-8"; | ||
| 30 | 30 | ||
| 31 | - private static final String GET = "GET"; // GET | ||
| 32 | - private static final String POST = "POST";// POST | ||
| 31 | + private static final String GET = "GET"; | ||
| 32 | + private static final String POST = "POST"; | ||
| 33 | 33 | ||
| 34 | 34 | private final static String USER_COOKIE_KEY = "uid"; | |
| 35 | 35 | private final static String USER_COOKIE_SECRET = "&#%!&*"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -226,8 +226,8 @@ public static final int[] solarToLunar(int year, int month, int monthDay) { | |||
| 226 | 226 | ||
| 227 | 227 | // 农历年份 | |
| 228 | 228 | lunarDate[0] = iYear; | |
| 229 | - | ||
| 230 | - int leapMonth = leapMonth(iYear); // 闰哪个月,1-12 | ||
| 229 | + // 闰哪个月,1-12 | ||
| 230 | + int leapMonth = leapMonth(iYear); | ||
| 231 | 231 | boolean isLeap = false; | |
| 232 | 232 | // 用当年的天数offset,逐个减去每月(农历)的天数,求出当天是本月的第几天 | |
| 233 | 233 | int iMonth, daysOfMonth = 0; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,7 +120,8 @@ public static int randomIndexByProb(List<Integer> probs) { | |||
| 120 | 120 | return -1; | |
| 121 | 121 | } | |
| 122 | 122 | int totalProb = newProbs.getLast(); | |
| 123 | - if (totalProb == 0) {// 总概率为0 | ||
| 123 | + // 总概率为0 | ||
| 124 | + if (totalProb == 0) { | ||
| 124 | 125 | return -1; | |
| 125 | 126 | } | |
| 126 | 127 | int random = random(0, totalProb - 1); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -490,8 +490,8 @@ public static String replace(String strSrc, String strOld, String strNew) { | |||
| 490 | 490 | } | |
| 491 | 491 | ||
| 492 | 492 | int i = 0; | |
| 493 | - | ||
| 494 | - if (strOld.equals(strNew)) //避免新旧字符一样产生死循环 | ||
| 493 | + //避免新旧字符一样产生死循环 | ||
| 494 | + if (strOld.equals(strNew)) | ||
| 495 | 495 | { | |
| 496 | 496 | return strSrc; | |
| 497 | 497 | } | |
@@ -893,7 +893,8 @@ public static StringBuffer decodeUnicode(final String dataStr) { | |||
| 893 | 893 | } else { | |
| 894 | 894 | charStr = dataStr.substring(start + 2, end); | |
| 895 | 895 | } | |
| 896 | - char letter = (char) Integer.parseInt(charStr, 16); // 16进制parse整形字符串。 | ||
| 896 | + // 16进制parse整形字符串。 | ||
| 897 | + char letter = (char) Integer.parseInt(charStr, 16); | ||
| 897 | 898 | buffer.append(Character.toString(letter)); | |
| 898 | 899 | start = end; | |
| 899 | 900 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -119,7 +119,8 @@ public static String date2Str(String pattern, Date aDate) { | |||
| 119 | 119 | public static Date convertStringToDate(String datePattern, String strDate) { | |
| 120 | 120 | SimpleDateFormat df; | |
| 121 | 121 | Date date; | |
| 122 | - if (strDate.split(SymbolConst.HENGXIAN).length < 2) {//传入的时间是以 / 分割 | ||
| 122 | + //传入的时间是以 / 分割 | ||
| 123 | + if (strDate.split(SymbolConst.HENGXIAN).length < 2) { | ||
| 123 | 124 | strDate = strDate.replace(SymbolConst.ZHENGXIEXIAN, SymbolConst.HENGXIAN); | |
| 124 | 125 | } | |
| 125 | 126 | if (strDate.split(SymbolConst.SPACE).length > 1) { | |
@@ -141,7 +142,8 @@ public static Date convertStringToDate(String datePattern, String strDate) { | |||
| 141 | 142 | */ | |
| 142 | 143 | public static Date convertStringToDate(String strDate) { | |
| 143 | 144 | Date aDate; | |
| 144 | - if (strDate.split(SymbolConst.HENGXIAN).length < 2) {//传入的时间是以 / 分割 | ||
| 145 | + //传入的时间是以 / 分割 | ||
| 146 | + if (strDate.split(SymbolConst.HENGXIAN).length < 2) { | ||
| 145 | 147 | strDate = strDate.replace(SymbolConst.ZHENGXIEXIAN, SymbolConst.HENGXIAN); | |
| 146 | 148 | } | |
| 147 | 149 | aDate = convertStringToDate(DATE_PATTERN_WITH_HENGXIAN, strDate); | |
@@ -731,32 +733,41 @@ public static long getTimeFromString(String timeStr, String format) { | |||
| 731 | 733 | */ | |
| 732 | 734 | public static String getLeftTimeString(long leftTime) { | |
| 733 | 735 | StringBuilder sb = new StringBuilder(); | |
| 734 | - int leftSecond = (int) (leftTime / 1000);// 剩余秒数 | ||
| 735 | - int second = leftSecond % 60;// 秒数 | ||
| 736 | + // 剩余秒数 | ||
| 737 | + int leftSecond = (int) (leftTime / 1000); | ||
| 738 | + // 秒数 | ||
| 739 | + int second = leftSecond % 60; | ||
| 736 | 740 | if (second > 0) { | |
| 737 | 741 | sb.insert(0, second + "秒"); | |
| 738 | 742 | } | |
| 739 | - int leftMinute = leftSecond / 60;// 剩余分钟数 | ||
| 740 | - int minute = leftMinute % 60;// 分钟数 | ||
| 743 | + // 剩余分钟数 | ||
| 744 | + int leftMinute = leftSecond / 60; | ||
| 745 | + // 分钟数 | ||
| 746 | + int minute = leftMinute % 60; | ||
| 741 | 747 | if (minute > 0) { | |
| 742 | 748 | sb.insert(0, minute + "分"); | |
| 743 | 749 | } | |
| 744 | - int leftHour = leftMinute / 60;// 剩余小时 | ||
| 750 | + // 剩余小时 | ||
| 751 | + int leftHour = leftMinute / 60; | ||
| 745 | 752 | int hour = leftHour % 24; | |
| 746 | 753 | if (hour > 0) { | |
| 747 | 754 | sb.insert(0, hour + "小时"); | |
| 748 | 755 | } | |
| 749 | - int leftDay = leftHour / 24;// 剩余天数 | ||
| 756 | + // 剩余天数 | ||
| 757 | + int leftDay = leftHour / 24; | ||
| 750 | 758 | if (leftDay > 0) { | |
| 751 | 759 | sb.insert(0, leftDay + "天"); | |
| 752 | 760 | } | |
| 753 | - int day = (int) (leftTime / ONE_DAY_IN_MILLISECONDS);// 获取剩余天数 | ||
| 754 | - if (day > 0) {// 1天及以上的显示剩余天 | ||
| 761 | + // 获取剩余天数 | ||
| 762 | + int day = (int) (leftTime / ONE_DAY_IN_MILLISECONDS); | ||
| 763 | + // 1天及以上的显示剩余天 | ||
| 764 | + if (day > 0) { | ||
| 755 | 765 | sb.append(day).append("天"); | |
| 756 | 766 | leftTime -= (day * ONE_DAY_IN_MILLISECONDS); | |
| 757 | 767 | } | |
| 758 | 768 | hour = (int) (leftTime / ONE_HOUR_IN_MILLISECONDS); | |
| 759 | - if (hour > 0 || sb.length() > 0) {// 1小时及以上或者前面显示了天数则后面需要小时 | ||
| 769 | + // 1小时及以上或者前面显示了天数则后面需要小时 | ||
| 770 | + if (hour > 0 || sb.length() > 0) { | ||
| 760 | 771 | sb.append(hour).append("小时"); | |
| 761 | 772 | leftTime -= (hour * ONE_HOUR_IN_MILLISECONDS); | |
| 762 | 773 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,7 +95,8 @@ public static void modifyDocument(File inputXml, String nodes, String attributeN | |||
| 95 | 95 | } | |
| 96 | 96 | } | |
| 97 | 97 | XMLWriter output; | |
| 98 | - if (outXml != null) { //指定输出文件 | ||
| 98 | + //指定输出文件 | ||
| 99 | + if (outXml != null) { | ||
| 99 | 100 | output = new XMLWriter(new FileWriter(new File(outXml))); | |
| 100 | 101 | } else { //输出文件为原文件 | |
| 101 | 102 | output = new XMLWriter(new FileWriter(inputXml)); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments