List of usage examples for org.apache.commons.lang3 StringUtils join
public static String join(final Iterable<?> iterable, final String separator)
Joins the elements of the provided Iterable into a single String containing the provided elements.
No delimiter is added before or after the list.
From source file:com.blackducksoftware.integration.build.utils.FilePathGavExtractor.java
public Gav getMavenPathGav(final String filePath, final String localMavenRepoPath) { if (filePath == null || localMavenRepoPath == null) { return null; }//from w w w . ja v a 2s . c o m final String cleanedFilePath = filePath.replaceFirst(localMavenRepoPath, ""); final String[] cleanedFilePathSegments = cleanedFilePath.split(File.separator); String[] groupIdSegments; if (cleanedFilePathSegments[0].equals("")) { if (cleanedFilePathSegments.length < 4) { return null; } groupIdSegments = Arrays.copyOfRange(cleanedFilePathSegments, 1, cleanedFilePathSegments.length - 3); } else { if (cleanedFilePathSegments.length < 3) { return null; } groupIdSegments = Arrays.copyOfRange(cleanedFilePathSegments, 0, cleanedFilePathSegments.length - 3); } final String groupId = StringUtils.join(groupIdSegments, "."); final String artifactId = cleanedFilePathSegments[cleanedFilePathSegments.length - 3]; final String version = cleanedFilePathSegments[cleanedFilePathSegments.length - 2]; return new Gav(groupId, artifactId, version); }
From source file:de.micromata.genome.gwiki.plugin.rogmp3_1_0.CsvTable.java
public void store(File file) { StringBuilder sb = new StringBuilder(); for (String[] line : table) { sb.append(StringUtils.join(line, '|')).append("\n"); }//from w w w . j a va 2 s .co m try { FileOutputStream fout = new FileOutputStream(file); OutputStreamWriter sout = new OutputStreamWriter(fout, encoding); sout.write(sb.toString()); IOUtils.closeQuietly(sout); IOUtils.closeQuietly(fout); } catch (IOException ex) { throw new RuntimeException("CsvTable; File write : " + file.getAbsolutePath() + "; " + ex.getMessage(), ex); } }
From source file:com.creditcloud.corporation.factoring.Factoring.java
/** * ?centralBankRegisterNo/*ww w. j a v a 2 s. co m*/ * * @param strs * @return */ public static String toCentralBankRegisterNo(String[] strs) { if (strs == null) { return null; } return StringUtils.join(strs, CENTRALBANCK_REGISTER_NO_SEPERATOR); }
From source file:com.spotify.heroic.filter.impl.AndFilterImpl.java
@Override public String toString() { final List<String> parts = new ArrayList<String>(statements.size() + 1); parts.add(OPERATOR);/*from w w w . ja va 2s . c o m*/ for (final Filter statement : statements) { if (statement == null) { parts.add("<null>"); } else { parts.add(statement.toString()); } } return "[" + StringUtils.join(parts, ", ") + "]"; }
From source file:com.techcavern.wavetact.ircCommands.chanhalfop.Part.java
@Override public void onCommand(String command, User user, PircBotX network, String prefix, Channel channel, boolean isPrivate, int userPermLevel, String... args) throws Exception { if (args.length < 1 || (args.length == 1 && args[0].equalsIgnoreCase(channel.getName()))) { channel.send().part();// ww w .j a v a 2 s .c o m Registry.lastLeftChannel.put(network, channel.getName()); } else { if (userPermLevel >= 20) { boolean permanent = false; if (args[0].startsWith("+")) { args[0] = args[0].replace("+", ""); permanent = true; } Registry.lastLeftChannel.put(network, args[0]); Registry.messageQueue.get(network).add("PART " + args[0]); if (permanent) { Record netRecord = DatabaseUtils.getNetwork(IRCUtils.getNetworkNameByNetwork(network)); Set<String> channels = new HashSet<>( Arrays.asList(StringUtils.split(netRecord.getValue(NETWORKS.CHANNELS), ", "))); channels.remove(args[0]); netRecord.setValue(NETWORKS.CHANNELS, StringUtils.join(channels, ", ")); DatabaseUtils.updateNetwork(netRecord); } } else { IRCUtils.sendError(user, network, channel, "Permission denied", prefix); } } }
From source file:com.spotify.heroic.filter.AndFilter.java
@Override public String toString() { final List<String> parts = new ArrayList<>(filters.size() + 1); parts.add(OPERATOR);//from w ww. j av a2 s . co m for (final Filter statement : filters) { parts.add(statement.toString()); } return "[" + StringUtils.join(parts, ", ") + "]"; }
From source file:models.PullRequestMergeResult.java
public String getConflictFilesToString() { if (gitConflicts == null) { return StringUtils.EMPTY; }//from ww w .j a v a 2 s. co m return StringUtils.join(gitConflicts.conflictFiles, PullRequest.DELIMETER); }
From source file:hu.bme.mit.sette.tools.spf.JPFConfig.java
public StringBuilder generate() { StringBuilder sb = new StringBuilder(); if (StringUtils.isNotBlank(target)) { sb.append("target=").append(target).append('\n'); }// w ww . j a v a 2 s . com if (symbolicMethod != null && symbolicMethod.size() > 0) { sb.append("symbolic.method="); sb.append(StringUtils.join(symbolicMethod, ',')); sb.append('\n'); } if (StringUtils.isNotBlank(classpath)) { sb.append("classpath=").append(classpath).append('\n'); } if (StringUtils.isNotBlank(listener)) { sb.append("listener=").append(listener).append('\n'); } if (StringUtils.isNotBlank(symbolicDebug)) { sb.append("symbolic.debug=").append(symbolicDebug).append('\n'); } if (StringUtils.isNotBlank(searchMultipleErrors)) { sb.append("search.multiple_errors=").append(searchMultipleErrors).append('\n'); } if (StringUtils.isNotBlank(decisionProcedure)) { sb.append("symbolic.dp=").append(decisionProcedure).append('\n'); } return sb; }
From source file:jease.cms.domain.property.ChoiceProperty.java
public String toString() { return StringUtils.join(value, "\n"); }
From source file:io.ingenieux.lambda.shell.LambdaShell.java
private static void runCommandArray(OutputStream os, String... args) throws Exception { PrintWriter pw = new PrintWriter(os, true); File tempPath = File.createTempFile("tmp-", ".sh"); IOUtils.write(StringUtils.join(args, " "), new FileOutputStream(tempPath)); List<String> processArgs = new ArrayList<>(Arrays.asList("/bin/bash", "-x", tempPath.getAbsolutePath())); ProcessBuilder psBuilder = new ProcessBuilder(processArgs).// redirectErrorStream(true);// final Process process = psBuilder.start(); final Thread t = new Thread(() -> { try {/*from www. j av a2s . c o m*/ IOUtils.copy(process.getInputStream(), os); } catch (IOException e) { throw new RuntimeException(e); } }); t.start(); process.waitFor(); t.join(); int resultCode = process.exitValue(); }