本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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;
}
示例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));
}
}