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


Java StringUtils.splitPreserveAllTokens方法代碼示例

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


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

示例1: find

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public Path find() throws BackgroundException {
    final Path home = super.find();
    if(home == DEFAULT_HOME) {
        final String user;
        final Credentials credentials = session.getHost().getCredentials();
        if(StringUtils.contains(credentials.getUsername(), ':')) {
            user = StringUtils.splitPreserveAllTokens(credentials.getUsername(), ':')[1];
        }
        else {
            user = credentials.getUsername();
        }
        return new Path(new StringBuilder()
                .append(Path.DELIMITER).append(session.getRegion())
                .append(Path.DELIMITER).append("home")
                .append(Path.DELIMITER).append(user)
                .toString(), EnumSet.of(Path.Type.directory, Path.Type.volume));
    }
    return home;
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:21,代碼來源:IRODSHomeFinderService.java

示例2: setUserName

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
public void setUserName(final String input) {
    final String user;
    final AuthScheme scheme;
    if(StringUtils.contains(input, ':')) {
        // Support non default auth scheme (PAM)
        user = StringUtils.splitPreserveAllTokens(input, ':')[1];
        // Defaults to standard if not found
        scheme = AuthScheme.findTypeByString(StringUtils.splitPreserveAllTokens(input, ':')[0]);
    }
    else {
        user = input;
        if(StringUtils.isNotBlank(host.getProtocol().getAuthorization())) {
            scheme = AuthScheme.findTypeByString(host.getProtocol().getAuthorization());
        }
        else {
            // We can default to Standard if not specified
            scheme = AuthScheme.STANDARD;
        }
    }
    super.setUserName(user);
    this.setAuthenticationScheme(scheme);
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:24,代碼來源:IRODSSession.java

示例3: toBean

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * Return a list of JPA bean re ad from the given CSV input. Headers are expected. {@inheritDoc}
 */
@Override
public <T> List<T> toBean(final Class<T> beanType, final Reader input) throws IOException {
	final List<T> result = new ArrayList<>();
	final Reader inputProxy = new BufferedReader(input);
	final String line = ((BufferedReader) inputProxy).readLine();
	if (line == null) {
		// No content means no header, no items.
		return result;
	}

	final CsvBeanReader<T> reader = new CsvBeanReader<>(inputProxy, beanType,
			StringUtils.splitPreserveAllTokens(line, CsvReader.DEFAULT_SEPARATOR));

	// Build all instances
	fillList(result, reader);
	return result;
}
 
開發者ID:ligoj,項目名稱:bootstrap,代碼行數:21,代碼來源:CsvForBean.java

示例4: writeComment

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
private void writeComment(String comment) throws IOException
{
    if (comment.isEmpty())
    {
        return;
    }
    String[] strings = StringUtils.splitPreserveAllTokens(comment, '\n');
    int i = 1;
    int size = strings.length;
    for (String string : strings)
    {
        this.writer.write(this.cachedIndent);
        this.writer.write("# ");
        this.writer.write(string);
        this.writeNewLine(true);
    }
    this.lineLock = false;
}
 
開發者ID:GotoFinal,項目名稱:diorite-configs-java8,代碼行數:19,代碼來源:CommentsWriter.java

示例5: addMethodIndent

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@SuppressWarnings("MagicNumber")
private static String addMethodIndent(String classCode)
{
    StringBuilder implStr = new StringBuilder(classCode.length() + (classCode.length() / 30));
    for (String s : StringUtils.splitPreserveAllTokens(classCode, '\n'))
    {
        implStr.append("    ").append(s).append("\n");
    }
    return implStr.toString();
}
 
開發者ID:GotoFinal,項目名稱:diorite-configs-java8,代碼行數:11,代碼來源:AbstractPropertyAction.java

示例6: getRegion

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
protected String getRegion() {
    if(StringUtils.contains(host.getRegion(), ':')) {
        return StringUtils.splitPreserveAllTokens(host.getRegion(), ':')[0];
    }
    return host.getRegion();
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:7,代碼來源:IRODSSession.java

示例7: parseDescriptorNames

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
protected String[] parseDescriptorNames(String list) {
	String[] header = StringUtils.splitPreserveAllTokens(list,new String(","));
	if (header != null)
		for (int i=0; i < header.length; i++)
			header[i] = header[i].trim();
	return header;
	
}
 
開發者ID:ideaconsult,項目名稱:appdomain,代碼行數:9,代碼來源:AppDomainModel.java

示例8: parseTsvLine

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
private void parseTsvLine(ArrayList<String> destination, String source) {
    final String[] split = StringUtils.splitPreserveAllTokens(source, "\t");
    for (String s : split) {
        if (StringUtils.startsWith(s, "\"") && StringUtils.endsWith(s, "\"")) {
            destination.add(s.substring(1, s.length() - 1));
        } else
            destination.add(s);
    }

}
 
開發者ID:BigBrassBand,項目名稱:remittanceparse,代碼行數:11,代碼來源:RemittanceParser.java

示例9: split

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@Override
protected  String[] split(String str, String separatorChars, int max, boolean preserveAllTokens) {
    if (preserveAllTokens) {
        return StringUtils.splitPreserveAllTokens(str, separatorChars, max);
    } else {
        return StringUtils.split(str, separatorChars, max);
    }
}
 
開發者ID:virjar,項目名稱:vscrawler,代碼行數:9,代碼來源:Split.java

示例10: addDebugLines

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
@SuppressWarnings("MagicNumber")
static String addDebugLines(String classCode)
{
    StringBuilder implStr = new StringBuilder(classCode.length() + (classCode.length() / 30));
    int i = 1;
    for (String s : StringUtils.splitPreserveAllTokens(classCode, '\n'))
    {
        implStr.append("/* ").append(i++).append(" */").append(s).append("\n");
    }
    return implStr.toString();
}
 
開發者ID:GotoFinal,項目名稱:diorite-configs-java8,代碼行數:12,代碼來源:GroovyTemplateException.java

示例11: getResource

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
protected String getResource() {
    if(StringUtils.contains(host.getRegion(), ':')) {
        return StringUtils.splitPreserveAllTokens(host.getRegion(), ':')[1];
    }
    return StringUtils.EMPTY;
}
 
開發者ID:iterate-ch,項目名稱:cyberduck,代碼行數:7,代碼來源:IRODSSession.java

示例12: fillLockedData

import org.apache.commons.lang3.StringUtils; //導入方法依賴的package包/類
/**
 * Extract the {@link Date}, author, and the previous company from the locked attribute if available and matched
 * to the
 * expected {@link UserLdapRepository#lockedValue}
 * 
 * @param user
 *            The user to update.
 * @param lockedValue
 *            The locked value flag. May be <code>null</code>.
 */
private void fillLockedData(final SimpleUserOrg user, final String lockedValue) {
	if (StringUtils.startsWith(lockedValue, UserLdapRepository.this.lockedValue)) {
		// A locked account
		final String[] fragments = StringUtils.splitPreserveAllTokens(lockedValue, '|');
		user.setLocked(new Date(Long.parseLong(fragments[1])));
		user.setLockedBy(fragments[2]);
		user.setIsolated(StringUtils.defaultIfEmpty(fragments[3], null));
	}
}
 
開發者ID:ligoj,項目名稱:plugin-id-ldap,代碼行數:20,代碼來源:UserLdapRepository.java


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