List of usage examples for java.lang String concat
public String concat(String str)
From source file:cc.arduino.plugins.wifi101.flashers.Flasher.java
public String toString() { String names = modulename + " (" + version + ") ("; for (String lname : compatibleBoard) { names = names.concat(lname).concat(", "); }/* w w w. jav a 2 s .c o m*/ names = names.substring(0, (names.length() - 2)).concat(")"); names = StringUtils.abbreviate(names, 75); return names; }
From source file:ch.devmine.javaparser.Main.java
private static void parseAsTarArchive(Project project, HashMap<String, Package> packs, List<Language> languages, Language language, String arg) { int slashIndex = arg.lastIndexOf("/"); String projectName = arg.substring(slashIndex + 1, arg.lastIndexOf(".")); String projectRoute = arg.substring(0, slashIndex + 1); project.setName(projectName);//from www . ja va 2 s. c om try { TarArchiveInputStream tarInput = new TarArchiveInputStream(new FileInputStream(arg)); TarArchiveEntry entry; while (null != (entry = tarInput.getNextTarEntry())) { String entryName = entry.getName(); String fileName = entryName.substring(entryName.lastIndexOf("/") + 1); if (entryName.endsWith(".java") && !(fileName.startsWith("~") || fileName.startsWith("."))) { // add package containing source file to hashmap Package pack = new Package(); String packName = FileWalkerUtils.extractFolderName(entry.getName()); String packPath = extractPackagePath(entry.getName()); pack.setName(packName); pack.setPath(packPath); if (packs.get(packName) == null) { packs.put(packName, pack); } // parse java file String entryPath = projectRoute.concat(entryName); Parser parser = new Parser(entryPath, tarInput); SourceFile sourceFile = new SourceFile(); parseAndFillSourceFile(parser, sourceFile, entryPath, language, packs, packName); } } } catch (IOException ex) { Log.e(TAG, ex.getMessage()); } }
From source file:cz.zcu.kiv.crce.client.base.metadata.IdentityCapabilityVO.java
public void addCategory(String cat) { if (categories == null) { this.categories = new AttributeVO(Constants.ATTRIBUTE__CATEGORIES, cat); } else {//w w w. j a va 2s.c o m String oldVal = this.categories.getValue(); oldVal = oldVal.concat("," + cat); this.categories.setValue(oldVal); } }
From source file:hibench.DataGenerator.java
public void createDummy(Path dummy, int agents) throws IOException { LOG.info("Creating dummy file " + dummy + "with " + agents + " agents..."); DataPaths.checkHdfsFile(dummy, false); FileSystem fs = dummy.getFileSystem(new Configuration()); FSDataOutputStream out = fs.create(dummy); String dummyContent = ""; for (int i = 1; i <= agents; i++) { dummyContent = dummyContent.concat(Integer.toString(i) + "\n"); }//from ww w . j a v a 2s .c o m out.write(dummyContent.getBytes("UTF-8")); out.close(); }
From source file:com.hbc.api.trade.bdata.common.DownloadConfigService.java
/** * https ??/*w ww. ja v a2 s. c o m*/ * @param relativePath * @return */ public String getFullPath(String relativePath) { if (relativePath != null) { String downloadHost = ConfigLoader.getProp("host.download"); if (StringUtils.isBlank(downloadHost)) { downloadHost = ""; logger.info("?URL host"); } String fullPath = downloadHost.concat("/").concat(relativePath); logger.info("?URL" + fullPath); return fullPath; } return null; }
From source file:com.aperto.magnolia.vanity.VirtualVanityUriMapping.java
@Override public MappingResult mapURI(String uri, String queryString) { // CHECKSTYLE:ON MappingResult result = null;//from w w w . j ava2 s. co m try { if (isVanityCandidate(uri)) { String toUri = getUriOfVanityUrl(uri); if (isNotBlank(toUri)) { if (!containsAny(toUri, "?#") && isNotBlank(queryString)) { toUri = toUri.concat("?" + queryString); } result = new MappingResult(); result.setToURI(toUri); result.setLevel(uri.length()); } } } catch (PatternSyntaxException e) { LOGGER.error("A vanity url exclude pattern is not set correctly.", e); } return result; }
From source file:de.hshannover.f4.trust.iron.mapserver.communication.http.BasicAccessAuthenticationTest.java
private HttpRequest getHttpRequest(String user, String pass) { HttpRequestFactory factory = new DefaultHttpRequestFactory(); HttpRequest req = null;/*from ww w .j a v a2 s . c o m*/ String base64 = new String(Base64.encodeBase64(user.concat(":").concat(pass).getBytes())); try { req = factory .newHttpRequest(new BasicRequestLine("POST", "https://localhost:8444/", HttpVersion.HTTP_1_1)); req.addHeader("Accept-Encoding", "gzip,deflate"); req.addHeader("Content-Type", "application/soap+xml;charset=UTF-8"); req.addHeader("User-Agent", "IROND Testsuite/1.0"); req.addHeader("Host", "localhost:8444"); req.addHeader("Content-Length", "198"); req.addHeader("Authorization", "Basic " + base64); } catch (MethodNotSupportedException e) { e.printStackTrace(); } return req; }
From source file:org.gvnix.service.roo.addon.addon.security.GvNix509TrustManager.java
/** * Import certs in this.chain to the keystore given by the file passed. * // w w w .java 2s . c om * @param host * @param keystore * @param pass * @return * @throws Exception */ public X509Certificate[] addCerts(String host, File keystore, char[] pass) throws Exception { // Specific Exceptions thrown in this code: NoSuchAlgorithmException, // KeyStoreException, CertificateException, IOException X509Certificate[] chain = this.chain; if (chain == null) { return null; } KeyStore ks = loadKeyStore(keystore, pass); String alias = host; for (int i = 0; i < chain.length; i++) { X509Certificate cert = chain[i]; alias = alias.concat("-" + (i + 1)); ks.setCertificateEntry(alias, cert); alias = host; } if (keystore.canWrite()) { OutputStream out = null; try { out = new FileOutputStream(keystore); ks.store(out, pass); } finally { IOUtils.closeQuietly(out); } } else { throw new Exception(keystore.getAbsolutePath().concat(" is not writable. ") .concat("You should to import needed certificates in your") .concat(" JVM trustcacerts keystore.\n").concat("You have them in src/main/resources/*.cer.\n") .concat("Use keytool for that: ") .concat("http://download.oracle.com/javase/6/docs/technotes/tools/solaris/keytool.html")); } return chain; }
From source file:gov.nih.nci.caintegrator.application.analysis.grid.GenePatternGridRunnerImplTestIntegration.java
@Test public void testRunGistic() throws ConnectionException, InvalidCriterionException, IOException, ParameterException { StudySubscription subscription = setupStudySubscription(ArrayDataType.COPY_NUMBER); GisticParameters parameters = new GisticParameters(); parameters.setRefgeneFile(GisticRefgeneFileEnum.HUMAN_HG16); parameters.getServer().setUrl(GISTIC_URL); File zipFile = null;// ww w . j ava 2s. c o m GisticAnalysisJob job = new GisticAnalysisJob(); job.setSubscription(subscription); job.getGisticAnalysisForm().setGisticParameters(parameters); File samplesFile = new File(fileManager.getUserDirectory(subscription) + File.separator + GisticUtils.SAMPLE_FILE_PREFIX + "gisticSamplesFile.txt"); File markersFile = new File(fileManager.getUserDirectory(subscription) + File.separator + GisticUtils.MARKER_FILE_PREFIX + "gisticMarkersFile.txt"); File cnvFile = new File(fileManager.getUserDirectory(subscription) + File.separator + GisticUtils.CNV_SEGMENT_FILE_PREFIX + "gisticCnvFile.txt"); FileUtils.copyFile(TestDataFiles.GISTIC_SAMPLES_FILE, samplesFile); FileUtils.copyFile(TestDataFiles.GISTIC_MARKERS_FILE, markersFile); FileUtils.copyFile(TestDataFiles.GISTIC_CNV_FILE, cnvFile); zipFile = genePatternGridRunner.runGistic(updater, job, samplesFile, markersFile, cnvFile); assertNotNull(zipFile); List<String> filenames = ZipUtils.extractFromZip(zipFile.getAbsolutePath()); // if ZIP contains 3 files or less, this typically means the GP module failed to complete. boolean isNumFilesGreaterThan3 = filenames.size() > 3; String holdStr = "ZIP archive from GISTIC contains too few files: "; holdStr = holdStr.concat(Integer.toString(filenames.size())); assertTrue(holdStr, isNumFilesGreaterThan3); // If ZIP contains 9 files, this is the expected output from the GISTIC module. assertEquals(9, filenames.size()); zipFile.deleteOnExit(); FileUtils.deleteQuietly(fileManager.getUserDirectory(subscription)); }
From source file:org.apache.solr.core.BlobRepository.java
/** * Internal method that returns the contents of a blob and increments a reference count. Please return the same * object to decrease the refcount. Only the decoded content will be cached when this method is used. Component * authors attempting to share objects across cores should use * {@code SolrCore#loadDecodeAndCacheBlob(String, Decoder)} which ensures that a proper close hook is also created. * * @param key it is a combination of blob name and version like blobName/version * @param decoder a decoder that knows how to interpret the bytes from the blob * @return The reference of a blob// w w w .j av a 2 s.c o m */ BlobContentRef<Object> getBlobIncRef(String key, Decoder<Object> decoder) { return getBlobIncRef(key.concat(decoder.getName()), () -> addBlob(key, decoder)); }