List of usage examples for java.io PrintStream print
public void print(Object obj)
From source file:org.apache.drill.yarn.core.AppSpec.java
@Override public void dump(PrintStream out) { out.print("Memory (MB): "); out.println(memoryMb);//from ww w .ja v a2 s . com out.print("Vcores: "); out.println(vCores); out.print("Disks: "); out.println(disks); out.print("Application Name: "); out.println(appName); out.print("Queue: "); out.println(queueName); out.print("Priority: "); out.println(priority); super.dump(out); }
From source file:com.diversityarrays.dalclient.DalUtil.java
public static void showXmlResult(String xml, OutputStream out) { if (looksLikeDoctype(xml)) { // just print it! PrintStream ps = new PrintStream(out); ps.print(xml); ps.close();/*from ww w .jav a 2 s. com*/ } else { try { showXmlResult(xml, new OutputStreamWriter(out, ENCODING_UTF_8)); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Should never happen!", e); //$NON-NLS-1$ } } }
From source file:com.oltpbenchmark.util.ResultUploader.java
public void writeDBMetrics(PrintStream os) { os.print(collector.collectMetrics()); }
From source file:com.openkm.servlet.admin.UnitTestingServlet.java
/** * Print warn messages/* w w w.j a v a 2s. com*/ */ public void warn(PrintStream out, String msg) { out.print("<div class=\"warn\">" + msg + "</div>"); }
From source file:com.emc.ecs.sync.filter.ShellCommandFilter.java
private void drain(InputStream in, PrintStream out) throws IOException { while (in.available() > 0) { out.print((char) in.read()); }/*from www .j ava 2 s . c o m*/ }
From source file:eu.city4ageproject.delivery.HTTPService.java
/**{@inheritDoc} */ @Override//w w w .j av a 2s . c o m protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (req.getContentType() != null && req.getContentType().toLowerCase().contains("application/json") // && req.getCharacterEncoding() != null // && req.getCharacterEncoding().toLowerCase().contains("utf") // && req.getCharacterEncoding().toLowerCase().contains("8") ) { ServletInputStream is = req.getInputStream(); String request = IOUtils.toString(is, "UTF-8"); try { DeliveryRequest drequest = gsonBuilder.create().fromJson(request, DeliveryRequest.class); if (drequest.getPilotID() != null && !drequest.getPilotID().isEmpty() && drequest.getUserID() != null && !drequest.getUserID().isEmpty() && drequest.getIntervention() != null) { //connect to uAAL if (delivery.sendIntervention(drequest)) resp.setStatus(HttpServletResponse.SC_ACCEPTED); else resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); return; } //TODO get parameters into the Actual delivery } catch (JsonSyntaxException e) { e.printStackTrace(); } resp.setStatus(HttpServletResponse.SC_NOT_ACCEPTABLE); PrintStream ps = new PrintStream(resp.getOutputStream()); ps.print("Request not acceptable.\n cotnent is not compliant to schema."); } else { resp.setStatus(HttpServletResponse.SC_NOT_ACCEPTABLE); resp.setContentType("text/html"); resp.setCharacterEncoding("UTF-8"); PrintStream ps = new PrintStream(resp.getOutputStream()); ps.print("Request not acceptable.<br> " + "Content-Type: application/json <br>" // +" Content-Encoding: UTF-8" ); } }
From source file:com.sangupta.clitools.file.HexDump.java
public static void hexDump(PrintStream outStream, BufferedInputStream bis, int currentRow, int maxRows) throws IOException { int row = currentRow + 1; if (maxRows == 0) { maxRows = Integer.MAX_VALUE; } else {/*from ww w .j a v a2 s . c om*/ maxRows += currentRow; } StringBuilder builder1 = new StringBuilder(100); StringBuilder builder2 = new StringBuilder(100); while (bis.available() > 0) { outStream.printf("%04X ", row * 16); for (int j = 0; j < 16; j++) { if (bis.available() > 0) { int value = (int) bis.read(); builder1.append(String.format("%02X ", value)); if (!Character.isISOControl(value)) { builder2.append((char) value); } else { builder2.append("."); } } else { for (; j < 16; j++) { builder1.append(" "); } } } outStream.print(builder1); outStream.println(builder2); row++; if (row > maxRows) { break; } builder1.setLength(0); builder2.setLength(0); } }
From source file:com.adaptris.core.socket.SimpleProtocol.java
/** * @see com.adaptris.core.socket.Protocol#receiveDocumentError() *///w w w .ja v a 2 s. c o m public void receiveDocumentError() throws IOException, IllegalStateException { PrintStream out = new PrintStream(socket.getOutputStream(), true); out.print("500\r\n"); out.flush(); }
From source file:com.adaptris.core.socket.SimpleProtocol.java
/** * @see com.adaptris.core.socket.Protocol#receiveDocumentSuccess() *//*w ww.j a v a 2s. c om*/ public void receiveDocumentSuccess() throws IOException, IllegalStateException { PrintStream out = new PrintStream(socket.getOutputStream(), true); out.print("200\r\n"); out.flush(); }
From source file:com.adaptris.core.socket.SimpleProtocol.java
/** * @see com.adaptris.core.socket.Protocol#sendDocument(byte[]) */// ww w. ja va 2 s . co m public void sendDocument(byte[] bytes) throws IOException { PrintStream out = new PrintStream(socket.getOutputStream(), true); out.print(new String(bytes) + "\r\n"); out.flush(); UnbufferedLineInputStream in = new UnbufferedLineInputStream(socket.getInputStream()); String doc = in.readLine(); logR.trace("SendDocument Got Reply [" + doc + "]"); reply = doc.getBytes(); docSent = true; }