當前位置: 首頁>>代碼示例>>Java>>正文


Java StringUtil.split方法代碼示例

本文整理匯總了Java中net.sourceforge.subsonic.util.StringUtil.split方法的典型用法代碼示例。如果您正苦於以下問題:Java StringUtil.split方法的具體用法?Java StringUtil.split怎麽用?Java StringUtil.split使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.sourceforge.subsonic.util.StringUtil的用法示例。


在下文中一共展示了StringUtil.split方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getAvailableThemes

import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
/**
 * Returns a list of available themes.
 *
 * @return A list of available themes.
 */
public synchronized Theme[] getAvailableThemes() {
    if (themes == null) {
        themes = new ArrayList<Theme>();
        try {
            InputStream in = SettingsService.class.getResourceAsStream(THEMES_FILE);
            String[] lines = StringUtil.readLines(in);
            for (String line : lines) {
                String[] elements = StringUtil.split(line);
                if (elements.length == 2) {
                    themes.add(new Theme(elements[0], elements[1]));
                } else if (elements.length == 3) {
                    themes.add(new Theme(elements[0], elements[1], elements[2]));
                } else {
                    LOG.warn("Failed to parse theme from line: [" + line + "].");
                }
            }
        } catch (IOException x) {
            LOG.error("Failed to resolve list of themes.", x);
            themes.add(new Theme("default", "Subsonic default"));
        }
    }
    return themes.toArray(new Theme[themes.size()]);
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:29,代碼來源:SettingsService.java

示例2: getAvailableThemes

import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
/**
 * Returns a list of available themes.
 *
 * @return A list of available themes.
 */
public synchronized Theme[] getAvailableThemes() {
    if (themes == null) {
        themes = new ArrayList<Theme>();
        try {
            InputStream in = SettingsService.class.getResourceAsStream(THEMES_FILE);
            String[] lines = StringUtil.readLines(in);
            for (String line : lines) {
                String[] elements = StringUtil.split(line);
                if (elements.length == 2) {
                    themes.add(new Theme(elements[0], elements[1]));
                } else {
                    LOG.warn("Failed to parse theme from line: [" + line + "].");
                }
            }
        } catch (IOException x) {
            LOG.error("Failed to resolve list of themes.", x);
            themes.add(new Theme("default", "Subsonic default"));
        }
    }
    return themes.toArray(new Theme[themes.size()]);
}
 
開發者ID:FutureSonic,項目名稱:FutureSonic-Server,代碼行數:27,代碼來源:SettingsService.java

示例3: parse

import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
public static MediaLibraryStatistics parse(String s) {
    try {
        String[] strings = StringUtil.split(s);
        return new MediaLibraryStatistics(
                Integer.parseInt(strings[0]),
                Integer.parseInt(strings[1]),
                Integer.parseInt(strings[2]),
                Integer.parseInt(strings[3]),
                Integer.parseInt(strings[4]),
                Integer.parseInt(strings[5]),
                Integer.parseInt(strings[6]),
                Integer.parseInt(strings[7]),
                Long.parseLong(strings[8]),
                Long.parseLong(strings[9]));
    } catch (Exception e) {
        LOG.warn("Failed to parse media library statistics: " + s);
        return new MediaLibraryStatistics();
    }
}
 
開發者ID:FutureSonic,項目名稱:FutureSonic-Server,代碼行數:20,代碼來源:MediaLibraryStatistics.java

示例4: isTranscodingStepInstalled

import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
private boolean isTranscodingStepInstalled(String step) {
    if (StringUtils.isEmpty(step)) {
        return true;
    }
    String executable = StringUtil.split(step)[0];
    PrefixFileFilter filter = new PrefixFileFilter(executable);
    String[] matches = getTranscodeDirectory().list(filter);
    return matches != null && matches.length > 0;
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:10,代碼來源:TranscodingService.java

示例5: parse

import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
public static MediaLibraryStatistics parse(String s) {
    try {
        String[] strings = StringUtil.split(s);
        return new MediaLibraryStatistics(
                Integer.parseInt(strings[0]),
                Integer.parseInt(strings[1]),
                Integer.parseInt(strings[2]),
                Long.parseLong(strings[3]),
                Long.parseLong(strings[4]));
    } catch (Exception e) {
        LOG.warn("Failed to parse media library statistics: " + s);
        return new MediaLibraryStatistics();
    }
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:15,代碼來源:MediaLibraryStatistics.java

示例6: getShortcutsAsArray

import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
public String[] getShortcutsAsArray() {
    return StringUtil.split(getShortcuts());
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:4,代碼來源:SettingsService.java

示例7: getSourceFormatsAsArray

import net.sourceforge.subsonic.util.StringUtil; //導入方法依賴的package包/類
public String[] getSourceFormatsAsArray() {
    return StringUtil.split(sourceFormats);
}
 
開發者ID:sindremehus,項目名稱:subsonic,代碼行數:4,代碼來源:Transcoding.java


注:本文中的net.sourceforge.subsonic.util.StringUtil.split方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。