@Override public void dump(OutputStream output) { try (PrintWriter printWriter = new PrintWriter(new OutputStreamWriter(output, UTF_8))) { for (Long value : histogramStatistics.getValues()) { printWriter.printf("%d%n", value); } } } }
private void printUnmatchedArgsBindingList(List<UnmatchedArgsBinding> unmatchedArgsBindings, PrintWriter pw, String indent) { pw.printf("%sUnmatchedArgsBindings:", indent); pw.println(unmatchedArgsBindings.isEmpty() ? " []" : ""); for (UnmatchedArgsBinding unmatched : unmatchedArgsBindings) { pw.printf("%sgetter: %s%n", indent + "- ", unmatched.getter()); pw.printf("%ssetter: %s%n", indent + " ", unmatched.setter()); } }
/** * Writes the values of the snapshot to the given stream. * * @param output an output stream */ @Override public void dump(OutputStream output) { final PrintWriter out = new PrintWriter(new OutputStreamWriter(output, UTF_8)); try { for (long value : values) { out.printf("%d%n", value); } } finally { out.close(); } }
private void report(long timestamp, String name, String header, String line, Object... values) { try { final File file = csvFileProvider.getFile(directory, name); final boolean fileAlreadyExists = file.exists(); if (fileAlreadyExists || file.createNewFile()) { try (PrintWriter out = new PrintWriter(new OutputStreamWriter( new FileOutputStream(file, true), UTF_8))) { if (!fileAlreadyExists) { out.println("t," + header); } out.printf(locale, String.format(locale, "%d" + separator + "%s%n", timestamp, line), values); } } } catch (IOException e) { LOGGER.warn("Error writing to {}", name, e); } }
/** * Get the stringly representation of footprint table * * @return footprint table */ public String toFootprint() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println(name + " instance footprint:"); pw.printf(" %9s %9s %9s %s%n", "COUNT", "AVG", "SUM", "DESCRIPTION"); for (Class<?> key : getClasses()) { int count = getClassCounts().count(key); int size = getClassSizes().count(key); pw.printf(" %9d %9d %9d %s%n", count, size / count, size, key.getName()); } pw.printf(" %9d %9s %9d %s%n", totalCount(), "", totalSize(), "(total)"); pw.println(); pw.close(); return sw.toString(); }
public static void writeConllFile(String outFile, List<CoreMap> sentences, List<DependencyTree> trees) { try { PrintWriter output = IOUtils.getPrintWriter(outFile); for (int i = 0; i < sentences.size(); i++) { CoreMap sentence = sentences.get(i); DependencyTree tree = trees.get(i); List<CoreLabel> tokens = sentence.get(CoreAnnotations.TokensAnnotation.class); for (int j = 1, size = tokens.size(); j <= size; ++j) { CoreLabel token = tokens.get(j - 1); output.printf("%d\t%s\t_\t%s\t%s\t_\t%d\t%s\t_\t_%n", j, token.word(), token.tag(), token.tag(), tree.getHead(j), tree.getLabel(j)); } output.println(); } output.close(); } catch (Exception e) { throw new RuntimeIOException(e); } }
@Override public void saveToFilename(String s) { PrintWriter bw = null; try { bw = IOUtils.getPrintWriter(s); for (int i = 0, size = indexSize; i < size; i++) { E o = get(i); if (o != null) { bw.printf("%d=%s%n", i, o.toString()); } } bw.close(); } catch (IOException e) { e.printStackTrace(); } finally { if (bw != null) { bw.close(); } } }
public static void printCounter(TwoDimensionalCounter<String,String> cnt, String fname) { try { PrintWriter pw = new PrintWriter(new PrintStream(new FileOutputStream(new File(fname)),false,"UTF-8")); for(String key : cnt.firstKeySet()) { for(String val : cnt.getCounter(key).keySet()) { pw.printf("%s\t%s\t%d%n", key, val, (int) cnt.getCount(key, val)); } } pw.close(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
private String getDescription(BeanNotOfRequiredTypeException ex) { StringWriter description = new StringWriter(); PrintWriter printer = new PrintWriter(description); printer.printf( "The bean '%s' could not be injected as a '%s' because it is a " + "JDK dynamic proxy that implements:%n", ex.getBeanName(), ex.getRequiredType().getName()); for (Class<?> requiredTypeInterface : ex.getRequiredType().getInterfaces()) { printer.println("\t" + requiredTypeInterface.getName()); } return description.toString(); }
PrintWriter pw = new PrintWriter(sw); pw.println(name + " object externals:"); pw.printf(" %16s %10s %-" + typeLen + "s %-30s %s%n", "ADDRESS", "SIZE", "TYPE", "PATH", "VALUE"); for (long addr : addresses()) { Object obj = record(addr).obj(); pw.printf(" %16x %10d %-" + typeLen + "s %-30s %s%n", last, addr - last, "(something else)", "(somewhere else)", "(something else)"); pw.printf(" %16x %10d %-" + typeLen + "s %-30s %s%n", last, addr - last, "**** OVERLAP ****", "**** OVERLAP ****", "**** OVERLAP ****"); pw.printf(" %16x %10d %-" + typeLen + "s %-30s %s%n", addr, size, obj.getClass().getName(), record(addr).path(), VMSupport.safeToString(obj)); last = addr + size; pw.println(); pw.close(); return sw.toString();
@Override public void dump(OutputStream output) { // Do not close this writer in order to keep output stream open. final PrintWriter p = new PrintWriter(new OutputStreamWriter(output, StandardCharsets.UTF_8)); p.printf("Dump of %s:%n", this); for (int i = 0; i < values.size(); i++) { p.printf("<%d> %s%n", i, values.get(i)); } p.flush(); } }
pwOut.println("GUESS TREEBANK:"); pwOut.println(guessTreebank.textualSummary()); pwOut.println("GOLD TREEBANK:"); pwOut.println(goldTreebank.textualSummary()); pwOut.printf("Yield mismatch gold: %d tokens vs. guess: %d tokens (lines: gold %d guess %d)%n", goldYield.size(), guessYield.size(), goldLineId, guessLineId); skippedGuessTrees++; continue; pwOut.println("================================================================================"); if(skippedGuessTrees != 0) pwOut.printf("%s %d guess trees\n", "Unable to evaluate", skippedGuessTrees); metric.display(true, pwOut); pwOut.println(); pwOut.close();
private static void printCommandElementDefClose(PrintWriter pw, Object userObject, String indent) { if (userObject instanceof Method || userObject instanceof ExecutableElement) { String full = (userObject).toString(); pw.print(full.substring(full.indexOf(')'))); pw.println(" {"); pw.println(indent + " // TODO implement commandSpec"); pw.println(indent + "}"); } else { pw.printf("%s}%n", indent); } }
out = new PrintWriter(new OutputStreamWriter(rsp.getOutputStream())); } catch (IllegalStateException e) { out = rsp.getWriter(); out.printf( "<html><head>" + "<meta http-equiv='refresh' content='1;url=%1$s'/>" + cause.report(out); out.printf( "-->\n\n"+ "</body></html>"); out.close();
try (PrintWriter pw = new PrintWriter(writer)) { pw.printf("%s grabbed %s from queue but %s %s. ", getName(), workUnit, owner.getDisplayName(), reason); if (owner.getTerminatedBy().isEmpty()) { pw.print("No termination trace available."); } else { pw.println("Termination trace follows:"); for (Computer.TerminationRequest request : owner.getTerminatedBy()) { Functions.printStackTrace(request, pw);
public static String vmDetails() { StringWriter sw = new StringWriter(); PrintWriter out = new PrintWriter(sw); out.println("Running " + (ADDRESS_SIZE * 8) + "-bit " + VM_NAME + " VM."); if (USE_COMPRESSED_REFS) out.println("Using compressed references with " + COMPRESSED_REF_SHIFT + "-bit shift."); out.println("Objects are " + OBJ_ALIGNMENT + " bytes aligned."); out.printf("%-19s: %d, %d, %d, %d, %d, %d, %d, %d, %d [bytes]%n", "Field sizes by type", REF_SIZE, ); out.printf("%-19s: %d, %d, %d, %d, %d, %d, %d, %d, %d [bytes]%n", "Array element sizes", U.arrayIndexScale(Object[].class), ); out.close(); return sw.toString();
/** * Writes the values of the snapshot to the given stream. * * @param output an output stream */ @Override public void dump(OutputStream output) { try (PrintWriter out = new PrintWriter(new OutputStreamWriter(output, UTF_8))) { for (long value : values) { out.printf("%d%n", value); } } } }
out.println("# This file lists the features and their weights to be used for\n" + "# creating the MARY features file.\n" + "# The same file can also be used to override weights in a run-time system.\n" + "# Three sections are distinguished: Byte-valued, Short-valued, and\n" + "# Continuous features.\n" + "#\n" + "# and all unit feature files for individual database utterances.\n" + "# THIS FILE WAS GENERATED AUTOMATICALLY"); out.println(); out.println("ByteValuedFeatureProcessors"); List<String> getValuesOf10 = new ArrayList<String>(); getValuesOf10.add("phone"); break; out.printf("%d linear | %s\n", featureValue, featureName); out.close();
private void printPositionalList(List<PositionalParamSpec> positionals, PrintWriter pw, String indent) { pw.printf("%sPositionalParams:", indent); pw.println(positionals.isEmpty() ? " []" : ""); for (PositionalParamSpec positional : positionals) { printPositional(positional, pw, indent); } } private void printPositional(PositionalParamSpec positional, PrintWriter pw, String indent) {