当前位置: 首页>>代码示例>>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;未经允许,请勿转载。