List of usage examples for java.lang System lineSeparator
String lineSeparator
To view the source code for java.lang System lineSeparator.
Click Source Link
From source file:dhr.uploadtomicrobit.FirmwareGenerator.java
public String generateFirmware(String script) { System.out.println("Sketch being processed"); System.out.println(script);/*from w w w . j a v a 2 s. c om*/ StringBuilder output = new StringBuilder(); StringBuilder tempScript = new StringBuilder(); // Get the whole script into output. output.append(MicrobitFirmware.getFirmware()); //System.out.println("Firmware is: " + output.toString()); // add header, pad to multiple of 16 bytes int[] data = new int[4 + script.length() + (16 - (4 + script.length()) % 16)]; data[0] = 77; // 'M' data[1] = 80; // 'P' data[2] = script.length() & 0xff; data[3] = (script.length() >> 8) & 0xff; for (int i = 0; i < script.length(); ++i) { int codePointAt0 = Character.codePointAt(script, i); data[4 + i] = codePointAt0; } // convert to .hex format int addr = 0x3e000; // magic start address in flash int[] chunk = new int[5 + 16]; //output.append(":020000040003F7\n"); for (int i = 0; i < data.length; i += 16, addr += 16) { chunk[0] = 16; // length of data section chunk[1] = (addr >> 8) & 0xff; // high byte of 16-bit addr chunk[2] = addr & 0xff; // low byte of 16-bit addr chunk[3] = 0; // type (data) for (int j = 0; j < 16; ++j) { chunk[4 + j] = data[i + j]; } int checksum = 0; for (int j = 0; j < 4 + 16; ++j) { checksum += chunk[j]; } chunk[4 + 16] = (-checksum) & 0xff; tempScript.append(':' + hexlify(chunk)); tempScript.append(System.lineSeparator()); } // Simple replace strategy on the firmware should allow updates of the firmware //System.out.println(output.toString()); System.out.println(tempScript); replaceString(output, ":::::::::::::::::::::::::::::::::::::::::::", tempScript.toString()); //output.append(MicrobitFirmware.getFirmwareTrailer()); // Return a full string - ready to copy return output.toString(); }
From source file:io.cloudslang.lang.compiler.modeller.model.Metadata.java
private void appendMap(StringBuilder stringBuilder, Map<String, String> map) throws IOException { stringBuilder.append(System.lineSeparator()); for (Map.Entry<String, String> entry : map.entrySet()) { stringBuilder.append(" ").append(entry.getKey()); if (StringUtils.isNotEmpty(entry.getValue())) { stringBuilder.append(": "); }/* ww w. jav a2 s . co m*/ appendString(stringBuilder, entry.getValue(), " "); } }
From source file:com.wormsim.data.SimulationConditions.java
@Override public String toString() { StringBuilder b = new StringBuilder(); b.append("{").append(System.lineSeparator()); b.append("\tfood ~ ").append(Utils.realDistributionToString(food_dist)); b.append(System.lineSeparator()); for (int i = 0; i < pheromone_dists.size(); i++) { b.append("\tpheromone[").append(i).append("] ~ ") .append(Utils.realDistributionToString(pheromone_dists.get(i))).append(System.lineSeparator()); }/* w w w .j a v a2 s. co m*/ group_dists.forEach((k, v) -> { b.append("\t").append(k).append(" ~ ").append(Utils.integerDistributionToString(v)) .append(System.lineSeparator()); }); b.append("}").append(System.lineSeparator()); return b.toString(); }
From source file:au.csiro.casda.sodalint.ValidateServiceDescriptorTest.java
/** * Test the validation of filter params in a v1.3 VOTable service descriptor document. * /*from w ww .j a va2 s .co m*/ * @throws IOException * If the data file cannot be read. */ @Test public void testVerifyV13BadParamServiceDescriptor() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos, false, CHARSET_UTF_8); Reporter reporter = new TextOutputReporter(ps, ReportType.values(), 10, false, 1024); String xmlContent = FileUtils .readFileToString(new File("src/test/resources/service-descriptor-v1_3-badparams.xml")); vsd.verifyServiceDescriptor(reporter, xmlContent); String result = baos.toString(CHARSET_UTF_8); System.out.println(result); String[] expectedMessages = new String[] { "E-SDMP-01 Required service descriptor ID PARAM is missing.", "E-SDIP-01 Service descriptor POS PARAM should have an attribute ucd with the value 'phys.angArea;obs'.", "E-SDIP-02 Service descriptor BAND PARAM should have an attribute unit with the value 'm'.", "E-SDIP-03 Service descriptor BAND PARAM should have an attribute xtype with the value 'interval'.", "E-SDIP-04 Service descriptor BAND PARAM should have an attribute arraysize with the value '2'.", "E-SDIP-05 Service descriptor TIME PARAM should have an attribute arraysize with the value '2'.", "W-SDSP-01 Standard service descriptor CIRCLE PARAM is missing." }; assertEquals("Messages should have been reported", StringUtils.join(expectedMessages, System.lineSeparator()), result.trim()); }
From source file:com.puppycrawl.tools.checkstyle.MainTest.java
@Test public void testNoConfigSpecified() throws Exception { exit.expectSystemExitWithStatus(-1); exit.checkAssertionAfterwards(new Assertion() { @Override//from ww w. j a va2s .co m public void checkAssertion() { assertEquals("Must specify a config XML file." + System.lineSeparator(), systemOut.getLog()); assertEquals("", systemErr.getLog()); } }); Main.main("src/test/resources/com/puppycrawl/tools/checkstyle/InputMain.java"); }
From source file:com.consol.citrus.admin.process.listener.WebSocketProcessListener.java
@Override public void onProcessSuccess(String processId) { messagingTemplate.convertAndSend(TOPIC_LOG_OUTPUT, SocketEvent.createEvent(processId, SocketEvent.PROCESS_SUCCESS, "process completed successfully" + System.lineSeparator())); }
From source file:com.adobe.acs.commons.replication.status.impl.SetReplicationStatusProcess.java
private Map<String, String> extractWorkflowParams(MetaDataMap metadataMap) { String[] lines = StringUtils.split(metadataMap.get(WorkflowHelper.PROCESS_ARGS, ""), System.lineSeparator()); Map<String, String> params = ParameterUtil.toMap(lines, "="); return params; }
From source file:com.amazonaws.codepipeline.jenkinsplugin.ValidationTest.java
@Test public void validatePluginNoCredentialsFailure() { final String error = "AWS CodePipeline Jenkins plugin setup error. One or more required configuration parameters have not been specified." + System.lineSeparator() + "The AWS credentials provided are not valid."; thrown.expect(Failure.class); thrown.expectMessage(error);//from w w w . j ava 2 s . com Validation.validatePlugin(null, null, "us-east-1", CategoryType.Build.getName(), "Jenkins-Build", "1", "ProjectName", null); }
From source file:org.apache.zeppelin.interpreter.recovery.FileSystemRecoveryStorage.java
@Override public Map<String, InterpreterClient> restore() throws IOException { Map<String, InterpreterClient> clients = new HashMap<>(); List<Path> paths = fs.list(new Path(recoveryDir + "/*.recovery")); for (Path path : paths) { String fileName = path.getName(); String interpreterSettingName = fileName.substring(0, fileName.length() - ".recovery".length()); String recoveryContent = fs.readFile(path); if (!StringUtils.isBlank(recoveryContent)) { for (String line : recoveryContent.split(System.lineSeparator())) { String[] tokens = line.split("\t"); String groupId = tokens[0]; String[] hostPort = tokens[1].split(":"); int connectTimeout = zConf .getInt(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT); RemoteInterpreterRunningProcess client = new RemoteInterpreterRunningProcess( interpreterSettingName, connectTimeout, hostPort[0], Integer.parseInt(hostPort[1])); // interpreterSettingManager may be null when this class is used when it is used // stop-interpreter.sh clients.put(groupId, client); LOGGER.info("Recovering Interpreter Process: " + hostPort[0] + ":" + hostPort[1]); }/*from w ww. j a va 2s. c o m*/ } } return clients; }
From source file:com.glluch.ecf2xmlmaven.Writer.java
protected static String terms2xml(String field_name, HashMap<String, Integer> terms) { String text = ""; Set pterms = terms.keySet();/*from ww w .ja v a2 s.co m*/ for (Object t : pterms) { text += "<field name=\"" + field_name + "\" " + " boost=\"" + terms.get(t) + "\"" + ">" + t + "</field>" + System.lineSeparator(); } return text; }