亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? translate.java

?? java servlet著名論壇源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
        if (bundleVariant == null) {
            Locale l = new Locale(bundleLanguage, bundleCountry);
            bundleVariant = l.getVariant();
        }

        if (toDir == null) {
            throw new BuildException("The todir attribute must be set.",
                                     getLocation());
        }

        if (!toDir.exists()) {
            toDir.mkdirs();
        } else {
            if (toDir.isFile()) {
                throw new BuildException(toDir + " is not a directory");
            }
        }

        if (srcEncoding == null) {
            srcEncoding = System.getProperty("file.encoding");
        }

        if (destEncoding == null) {
            destEncoding = srcEncoding;
        }

        if (bundleEncoding == null) {
            bundleEncoding = srcEncoding;
        }

        loadResourceMaps();

        translate();
    }

    /**
     * Load resource maps based on resource bundle encoding scheme.
     * The resource bundle lookup searches for resource files with various
     * suffixes on the basis of (1) the desired locale and (2) the default
     * locale (basebundlename), in the following order from lower-level
     * (more specific) to parent-level (less specific):
     *
     * basebundlename + "_" + language1 + "_" + country1 + "_" + variant1
     * basebundlename + "_" + language1 + "_" + country1
     * basebundlename + "_" + language1
     * basebundlename
     * basebundlename + "_" + language2 + "_" + country2 + "_" + variant2
     * basebundlename + "_" + language2 + "_" + country2
     * basebundlename + "_" + language2
     *
     * To the generated name, a ".properties" string is appeneded and
     * once this file is located, it is treated just like a properties file
     * but with bundle encoding also considered while loading.
     */
    private void loadResourceMaps() throws BuildException {
        Locale locale = new Locale(bundleLanguage,
                                   bundleCountry,
                                   bundleVariant);
        String language = locale.getLanguage().length() > 0 ?
            "_" + locale.getLanguage() :
            "";
        String country = locale.getCountry().length() > 0 ?
            "_" + locale.getCountry() :
            "";
        String variant = locale.getVariant().length() > 0 ?
            "_" + locale.getVariant() :
            "";
        String bundleFile = bundle + language + country + variant;
        processBundle(bundleFile, 0, false);

        bundleFile = bundle + language + country;
        processBundle(bundleFile, 1, false);

        bundleFile = bundle + language;
        processBundle(bundleFile, 2, false);

        bundleFile = bundle;
        processBundle(bundleFile, 3, false);

        //Load default locale bundle files
        //using default file encoding scheme.
        locale = Locale.getDefault();

        language = locale.getLanguage().length() > 0 ?
            "_" + locale.getLanguage() :
            "";
        country = locale.getCountry().length() > 0 ?
            "_" + locale.getCountry() :
            "";
        variant = locale.getVariant().length() > 0 ?
            "_" + locale.getVariant() :
            "";
        bundleEncoding = System.getProperty("file.encoding");

        bundleFile = bundle + language + country + variant;
        processBundle(bundleFile, 4, false);

        bundleFile = bundle + language + country;
        processBundle(bundleFile, 5, false);

        bundleFile = bundle + language;
        processBundle(bundleFile, 6, true);
    }

    /**
     * Process each file that makes up this bundle.
     */
    private void processBundle(final String bundleFile, final int i,
                               final boolean checkLoaded) throws BuildException {
        final File propsFile = new File(bundleFile + ".properties");
        FileInputStream ins = null;
        try {
            ins = new FileInputStream(propsFile);
            loaded = true;
            bundleLastModified[i] = propsFile.lastModified();
            log("Using " + propsFile, Project.MSG_DEBUG);
            loadResourceMap(ins);
        } catch (IOException ioe) {
            log(propsFile + " not found.", Project.MSG_DEBUG);
            //if all resource files associated with this bundle
            //have been scanned for and still not able to
            //find a single resrouce file, throw exception
            if (!loaded && checkLoaded) {
                throw new BuildException(ioe.getMessage(), getLocation());
            }
        }
    }

    /**
     * Load resourceMap with key value pairs.  Values of existing keys
     * are not overwritten.  Bundle's encoding scheme is used.
     */
    private void loadResourceMap(FileInputStream ins) throws BuildException {
        try {
            BufferedReader in = null;
            InputStreamReader isr = new InputStreamReader(ins, bundleEncoding);
            in = new BufferedReader(isr);
            String line = null;
            while ((line = in.readLine()) != null) {
                //So long as the line isn't empty and isn't a comment...
                if (line.trim().length() > 1 &&
                   ('#' != line.charAt(0) || '!' != line.charAt(0))) {
                    //Legal Key-Value separators are :, = and white space.
                    int sepIndex = line.indexOf('=');
                    if (-1 == sepIndex) {
                        sepIndex = line.indexOf(':');
                    }
                    if (-1 == sepIndex) {
                        for (int k = 0; k < line.length(); k++) {
                            if (Character.isSpaceChar(line.charAt(k))) {
                                sepIndex = k;
                                break;
                            }
                        }
                    }
                    //Only if we do have a key is there going to be a value
                    if (-1 != sepIndex) {
                        String key = line.substring(0, sepIndex).trim();
                        String value = line.substring(sepIndex + 1).trim();
                        //Handle line continuations, if any
                        while (value.endsWith("\\")) {
                            value = value.substring(0, value.length() - 1);
                            if ((line = in.readLine()) != null) {
                                value = value + line.trim();
                            } else {
                                break;
                            }
                        }
                        if (key.length() > 0) {
                            //Has key already been loaded into resourceMap?
                            if (resourceMap.get(key) == null) {
                                resourceMap.put(key, value);
                            }
                        }
                    }
                }
            }
            if (in != null) {
                in.close();
            }
        } catch (IOException ioe) {
            throw new BuildException(ioe.getMessage(), getLocation());
        }
    }

    /**
     * Reads source file line by line using the source encoding and
     * searches for keys that are sandwiched between the startToken
     * and endToken.  The values for these keys are looked up from
     * the hashtable and substituted.  If the hashtable doesn't
     * contain the key, they key itself is used as the value.
     * Detination files and directories are created as needed.
     * The destination file is overwritten only if
     * the forceoverwritten attribute is set to true if
     * the source file or any associated bundle resource file is
     * newer than the destination file.
     */
    private void translate() throws BuildException {
        for (int i = 0; i < filesets.size(); i++) {
            FileSet fs = (FileSet) filesets.elementAt(i);
            DirectoryScanner ds = fs.getDirectoryScanner(getProject());
            String[] srcFiles = ds.getIncludedFiles();
            int srcFilesCount = srcFiles.length;
            if (srcFilesCount == 1) {
                log("Translating 1 file", Project.MSG_INFO);
            } else {
                log("Translating " + srcFilesCount + " files", Project.MSG_INFO);
            }
            for (int j = 0; j < srcFiles.length; j++) {
                try {
                    File dest = fileUtils.resolveFile(toDir, srcFiles[j]);
                    //Make sure parent dirs exist, else, create them.
                    try {
                        File destDir = new File(dest.getParent());
                        if (!destDir.exists()) {
                            destDir.mkdirs();
                        }
                    } catch (Exception e) {
                        log("Exception occured while trying to check/create "
                            + " parent directory.  " + e.getMessage(),
                            Project.MSG_DEBUG);
                    }
                    destLastModified = dest.lastModified();
                    File src = fileUtils.resolveFile(ds.getBasedir(), srcFiles[j]);
                    srcLastModified = src.lastModified();
                    //Check to see if dest file has to be recreated
                    if (forceOverwrite
                        || destLastModified < srcLastModified
                        || destLastModified < bundleLastModified[0]
                        || destLastModified < bundleLastModified[1]
                        || destLastModified < bundleLastModified[2]
                        || destLastModified < bundleLastModified[3]
                        || destLastModified < bundleLastModified[4]
                        || destLastModified < bundleLastModified[5]
                        || destLastModified < bundleLastModified[6]) {
                        log("Processing " + srcFiles[j],
                            Project.MSG_DEBUG);
                        FileOutputStream fos = new FileOutputStream(dest);
                        BufferedWriter out
                            = new BufferedWriter(new OutputStreamWriter(fos, destEncoding));
                        FileInputStream fis = new FileInputStream(src);
                        BufferedReader in
                            = new BufferedReader(new InputStreamReader(fis, srcEncoding));
                        String line;
                        while ((line = in.readLine()) != null) {
                            int startIndex = -1;
                            int endIndex = -1;
outer:                      while (true) {
                                startIndex = line.indexOf(startToken, endIndex + 1);
                                if (startIndex < 0 ||
                                    startIndex + 1 >= line.length()) {
                                    break;
                                }
                                endIndex = line.indexOf(endToken, startIndex + 1);
                                if (endIndex < 0) {
                                    break;
                                }
                                String matches = line.substring(startIndex + 1,
                                                                endIndex);
                                //log("match = " + matches + " resource = " + (String) resourceMap.get(matches), Project.MSG_WARN);
                                /**
                                 * Note: minhnn
                                 * I change the code to consider a valid
                                 * matches must begin with mvnforum
                                 */
                                if (matches.startsWith("mvnforum.") == false ) {
                                    endIndex = endIndex - 1;
                                    continue outer;
                                }
                                //If there is a white space or = or :, then
                                //it isn't to be treated as a valid key.
                                for (int k = 0; k < matches.length(); k++) {
                                    char c = matches.charAt(k);
                                    if (c == ':' ||
                                        c == '=' ||
                                        Character.isSpaceChar(c)) {
                                        endIndex = endIndex - 1;
                                        continue outer;
                                    }
                                }
                                String replace = null;
                                replace = (String) resourceMap.get(matches);

                                //If the key hasn't been loaded into resourceMap,
                                //use the key itself as the value also.
                                if (replace == null) {
                                    log("Warning: The key: " + matches
                                        + " hasn't been defined.",
                                        Project.MSG_WARN);
                                    replace = matches;
                                }
                                line = line.substring(0, startIndex)
                                    + replace
                                    + line.substring(endIndex + 1);
                                // minhnn: I dont know if the original code has bug
                                // I changed from "+ 1" to "- 1" and it works well
                                endIndex = startIndex + replace.length() - 1;
                                if (endIndex + 1 >= line.length()) {
                                    break;
                                }
                            }
                            out.write(line);
                            out.newLine();
                        }
                        if (in != null) {
                            in.close();
                        }
                        if (out != null) {
                            out.close();
                        }
                    } else {
                        log("Skipping " + srcFiles[j] +
                            " as destination file is up to date",
                            Project.MSG_VERBOSE);
                    }
                } catch (IOException ioe) {
                    throw new BuildException(ioe.getMessage(), getLocation());
                }
            }
        }
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日本一区二区三级电影在线观看| 欧美天堂一区二区三区| 一区二区三区鲁丝不卡| 国产精品乱人伦一区二区| 欧美精品日韩综合在线| 北条麻妃一区二区三区| 激情综合色播五月| 天堂在线亚洲视频| 亚洲国产欧美日韩另类综合 | 蜜臀av性久久久久蜜臀aⅴ四虎| 中文字幕在线不卡视频| 18欧美亚洲精品| 国产精品理论片| 国产精品人妖ts系列视频| 国产午夜精品美女毛片视频| 久久久噜噜噜久噜久久综合| 精品久久久久久无| 精品欧美一区二区三区精品久久| 欧美成人三级电影在线| 日韩欧美中文字幕一区| 国产亚洲女人久久久久毛片| 亚洲精品美腿丝袜| 亚洲国产综合在线| 久久99精品国产麻豆不卡| 国产麻豆午夜三级精品| 国产福利一区二区三区| 精品视频一区二区不卡| 日韩视频在线你懂得| 国产日韩欧美综合一区| 国产亚洲欧美中文| 亚洲女同ⅹxx女同tv| 蜜桃视频在线一区| 波波电影院一区二区三区| 欧洲一区二区av| 国产精品短视频| 国产精品12区| 欧美成人乱码一区二区三区| 亚洲欧美日韩国产综合| 91在线视频观看| 欧美激情综合在线| 全部av―极品视觉盛宴亚洲| 国产亚洲一区二区三区| 欧美国产1区2区| 国产一区二区成人久久免费影院| 欧美日本一区二区三区四区| 亚洲一区二区三区三| 99久久免费精品高清特色大片| 欧美日韩一区成人| 日韩理论片网站| a4yy欧美一区二区三区| 欧美一级二级三级蜜桃| 五月综合激情日本mⅴ| jiyouzz国产精品久久| 欧美韩国日本不卡| 美国十次了思思久久精品导航| 在线欧美小视频| 最新国产成人在线观看| 成人黄色免费短视频| 26uuu色噜噜精品一区| 免费成人av资源网| 欧美一级午夜免费电影| 亚洲最新视频在线播放| 欧美性猛交xxxxxx富婆| 视频在线在亚洲| 精品国产自在久精品国产| 美国毛片一区二区三区| 日韩精品中文字幕一区二区三区| 午夜视频久久久久久| 91成人网在线| 日本网站在线观看一区二区三区| 欧美三级电影网| 亚洲mv大片欧洲mv大片精品| 一本大道av伊人久久综合| 亚洲综合成人网| 91精品国产欧美一区二区18| 美女在线观看视频一区二区| 久久综合九色欧美综合狠狠| 国产精品一级黄| 亚洲综合免费观看高清完整版在线| 欧美老肥妇做.爰bbww| 国产一区二区精品久久91| 亚洲欧美电影一区二区| 精品国产伦理网| 久久成人羞羞网站| 亚洲国产精品国自产拍av| 在线亚洲一区二区| 免费国产亚洲视频| 亚洲人成7777| 久久亚洲精精品中文字幕早川悠里 | 国产精品一卡二卡| 夜夜嗨av一区二区三区四季av| 日韩免费高清视频| 91婷婷韩国欧美一区二区| 美女一区二区视频| 亚洲欧美日本在线| 久久久亚洲午夜电影| 欧美日本精品一区二区三区| 国产成人自拍在线| 天堂成人免费av电影一区| 国产精品丝袜久久久久久app| 欧美日韩一区视频| 成人激情小说乱人伦| 精品一区二区三区香蕉蜜桃 | 亚洲综合激情小说| 亚洲国产成人午夜在线一区| 日韩欧美国产午夜精品| 欧美亚洲一区二区在线| 岛国一区二区在线观看| 黄一区二区三区| 麻豆91精品91久久久的内涵| 亚洲成人1区2区| 亚洲一区在线观看网站| 亚洲一区二区三区自拍| 一区二区高清在线| 亚洲一二三四久久| 亚洲黄色在线视频| 亚洲精品你懂的| 亚洲国产成人va在线观看天堂| 亚洲免费在线播放| 亚洲在线观看免费视频| 夜夜操天天操亚洲| 日韩精品电影一区亚洲| 免费一级片91| 韩国成人福利片在线播放| 国产制服丝袜一区| 国产成人精品免费看| 972aa.com艺术欧美| 欧美日韩精品三区| 日韩一区二区免费在线电影| 日韩欧美国产不卡| 国产精品蜜臀av| 一区二区三区国产精品| 六月丁香婷婷色狠狠久久| 国产一区 二区| 一本大道久久a久久综合| 91精品国产综合久久香蕉麻豆| 欧美一区二区在线免费观看| 精品国产亚洲在线| 亚洲精选一二三| 欧美aⅴ一区二区三区视频| 狠狠色综合日日| 91麻豆蜜桃一区二区三区| 亚洲三级在线看| 久久99精品久久只有精品| caoporm超碰国产精品| 欧美精品久久久久久久多人混战 | 一区二区三区日韩在线观看| 久久9热精品视频| 欧美午夜精品久久久久久孕妇| 国产午夜亚洲精品羞羞网站| 亚洲v精品v日韩v欧美v专区| 国产精品91一区二区| 3d成人动漫网站| 亚洲欧美日韩久久精品| 国产一区 二区 三区一级| 欧美日本在线观看| 亚洲精品成人在线| 粉嫩在线一区二区三区视频| 欧美一区二区在线免费观看| 亚洲影院在线观看| 99久久国产免费看| 欧美国产日韩一二三区| 国内精品伊人久久久久av影院 | 国产精品久久久久久久久快鸭 | 欧美激情在线一区二区| 久久国产人妖系列| 精品国产制服丝袜高跟| 免费日韩伦理电影| 曰韩精品一区二区| 91香蕉视频在线| 亚洲日韩欧美一区二区在线| av电影天堂一区二区在线观看| 国产欧美一区二区三区在线看蜜臀 | 国产精品久久久久久户外露出| 国产精品综合av一区二区国产馆| 日韩欧美在线影院| 国产二区国产一区在线观看| 国产亚洲视频系列| 91在线观看下载| 亚洲综合激情网| 日韩三级视频在线观看| 韩国成人在线视频| 亚洲视频一二三| 欧美疯狂性受xxxxx喷水图片| 日本免费新一区视频 | 欧美电视剧免费观看| 国产精品乡下勾搭老头1| 亚洲男人的天堂一区二区| 欧美精品第1页| 国产91在线看| 亚洲午夜久久久久久久久电影网| 日韩一区二区不卡| 成人美女视频在线看| 亚洲成人资源在线| 久久天天做天天爱综合色| 在线观看一区二区视频| 国产盗摄女厕一区二区三区| 亚洲一区二区高清| 久久午夜免费电影| 精品视频在线视频|