/*-------------------------------------------------[ Printing ]---------------------------------------------------
327463
public static void print(PrintStream out, String xpath, Object result){
        out.printf("XPath: %s%n", xpath);
        print(out, result, 2);
    }
18718
@Override
    public int print(
        ChronoDisplay formattable,
        Appendable buffer,
        AttributeQuery attributes,
        Set<ElementPosition> positions, // optional
        boolean quickPath
    ) throws IOException {

        ChronoFormatter<T> cf = this.getFormatter(attributes, quickPath, formattable);
        Set<ElementPosition> newPositions = cf.print(formattable, buffer, attributes, positions != null);

        if (positions != null) {
            assert (newPositions != null);
            positions.addAll(newPositions);
        }

        return Integer.MAX_VALUE;

    }
441133
@SuppressWarnings("PMD.AvoidCatchingThrowable")
    private void print(final Request req, final OutputStream output)
        throws IOException {
        try {
            new RsPrint(this.take.act(req)).print(output);
        } catch (final HttpException ex) {
            new RsPrint(BkBasic.failure(ex, ex.code())).print(output);
            // @checkstyle IllegalCatchCheck (7 lines)
        } catch (final Throwable ex) {
            new RsPrint(
                BkBasic.failure(
                    ex,
                    HttpURLConnection.HTTP_INTERNAL_ERROR
                )
            ).print(output);
        }
    }
696853
public void printDataStartForm(PrintWriter out, int iPrintOptions)
    {
        if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) != 0)
            out.println("<tr>\n<td colspan=\"20\">");
        out.println("<table border=\"0\" cellspacing=\"10\">\n<tr>");
    }
909102
protected void print(Object s) throws IOException {
        out.write(Convert.escapeUnicode(s.toString()));
    }
593203
public synchronized void print(java.io.PrintWriter printWriter)
    {
        super.print(printWriter);

        try {
            printWriter.println("State Dump for:" + cclass.getName()
                                + "\n storeFile=" + storeFile + "(java.io.RandomaccessFile)"
                                + "\n storeFileSizeUsed=" + storeFileSizeUsed + "(long)"
                                + " storeFileSizeAllocated=" + storeFileSizeAllocated + "(long)"
                                + " reservedSize=" + reservedSize + "(long)"
                                + " directoryReservedSize=" + directoryReservedSize + "(long)"
                                + "\n minimumStoreFileSize=" + minimumStoreFileSize
                                + " maximumStoreFileSize=" + maximumStoreFileSize
                                + "\n ((Directory.Node)directory.root).byteAddress=" + ((Directory.Node) directory.root).byteAddress
                                + "((Directory.Node)directory.root).length=" + ((Directory.Node) directory.root).length
                                + " directory.size()=" + directory.size()
                                + "\n freeSpaceStoreArea=" + freeSpaceStoreArea);
            printWriter.println();

            // directory.print(printWriter);
            // printWriter.println();

            printWriter.println("managedObjectsToWrite...");
            for (java.util.Iterator managedObjectIterator = managedObjectsToWrite.values().iterator(); managedObjectIterator.hasNext();) {
                ManagedObject managedObject = (ManagedObject) managedObjectIterator.next();
                printWriter.println(managedObject.toString());
            } // for ... managedObjectsToWrite.

            printWriter.println("tokensToDelete...");
            for (java.util.Iterator tokenIterator = tokensToDelete.values().iterator(); tokenIterator.hasNext();) {
                Token token = (Token) tokenIterator.next();
                printWriter.println(token.toString());
            } // for ... tokensToDelete.

            printWriter.println("directory...");
            printWriter.println("identifier          byteAddress         length");
            printWriter.println(("directoryRoot       ")
                                + (((Directory.Node) directory.root).byteAddress + "                    ").substring(0, 20)
                                + (((Directory.Node) directory.root).length + "                    ").substring(0, 20)
                            );
            for (Iterator storeAreaIterator = directory.entrySet().iterator(); storeAreaIterator.hasNext();) {
                Directory.StoreArea storeArea = (Directory.StoreArea) storeAreaIterator.next();
                printWriter.println((storeArea.identifier + "                    ").substring(0, 20)
                                    + (storeArea.byteAddress + "                    ").substring(0, 20)
                                    + (storeArea.length + "                    ").substring(0, 20)
                                );
                Directory.Node child = (Directory.Node) storeArea.getChild();
                if (child != null) {
                    printWriter.println(("directoryMetaData   ")
                                        + (child.byteAddress + "                    ").substring(0, 20)
                                        + (child.length + "                    ").substring(0, 20)
                                    );
                    if (storeArea.next.getKey() == null) {
                        storeArea = (Directory.StoreArea) storeArea.next;
                        child = (Directory.Node) storeArea.getChild();
                        printWriter.println(("directoryMetaData   ")
                                            + (child.byteAddress + "                    ").substring(0, 20)
                                            + (child.length + "                    ").substring(0, 20)
                                        );
                    } // if (storeArea.next.getKey() == null).                    
                } // if (child != null).
            } // for ... directory.
        } catch (ObjectManagerException objectManagerException) {
            // No FFDC code needed.
            printWriter.println("Caught objectManagerException=" + objectManagerException);
            objectManagerException.printStackTrace(printWriter);
        } // try...

        printWriter.println("cachedManagedObjects...");
        for (int i = 0; i < cachedManagedObjects.length; i++) {
            if (cachedManagedObjects[i] != null)
                printWriter.println(i + " " + cachedManagedObjects[i].toString());
        } // for cachedManagedObjects.

        printWriter.println("freeSpaceByLength.size()=" + freeSpaceByLength.size() + "\n... Address(long) Length(Long)");
        for (java.util.Iterator iterator = freeSpaceByLength.iterator(); iterator.hasNext();) {
            FreeSpace freeSpace = (FreeSpace) iterator.next();
            printWriter.println(freeSpace.address + " " + freeSpace.length);
        } // for freeSpaceAddress.

        printWriter.println("newFreeSpace.size()=" + newFreeSpace.size() + "\n... Address(long) Length(Long)");
        for (java.util.Iterator freeSpaceIterator = newFreeSpace.iterator(); freeSpaceIterator.hasNext();) {
            Directory.StoreArea storeArea = (Directory.StoreArea) freeSpaceIterator.next();
            printWriter.println(storeArea.byteAddress + " " + storeArea.length);
        } // for newFreeSpace.

    }
120283
public void printUsage(OutputStream os) {
        int count = 0;
        PrintStream out = UTF8.printStream(os);
        for (String option : optionList) {

            if (optionGroups.containsKey(count)) {
                out.println("  " + optionGroups.get(count));
            }
            count++;

            if (unlistedOptions.contains(option)) {
                continue;
            }
            out.print("    ");

            StringBuilder buf = new StringBuilder();
            buf.append(option);
            if (optionExtraPartSynopsisMap.get(option) != null) {
                String optionExtraPartSynopsis = optionExtraPartSynopsisMap.get(option);
                buf.append("[:");
                buf.append(optionExtraPartSynopsis);
                buf.append("]");
            }
            if (requiresArgumentSet.contains(option)) {
                buf.append(" <");
                buf.append(argumentDescriptionMap.get(option));
                buf.append(">");
            }
            printField(out, buf.toString(), maxWidth + 1);

            out.println(optionDescriptionMap.get(option));
        }
        out.flush();
    }
724881
function (toPrint, indent, indentEnd) {
      if (!indent) {
        indent = '&nbsp;&nbsp;'
      }
      if (!indentEnd) {
        indentEnd = ''
      }
      var s = ''
      var name
      if (toPrint instanceof Object) {
        s = 'Object (\n'
        for (name in toPrint) {
          if (toPrint.hasOwnProperty(name)) {
            s += indent + indent + '[' + name + '] => ' + this.printR(toPrint[name], indent + '&nbsp;&nbsp;', indent + indent)
          }
        }
        s += indentEnd + ')\n'
        return s
      } else if (toPrint instanceof Array) {
        s = 'Array (\n'
        for (name in toPrint) {
          if (toPrint.hasOwnProperty(name)) {
            s += indent + indent + '[' + name + '] => ' + this.printR(toPrint[name], indent + '&nbsp;&nbsp;', indent + indent)
          }
        }
        s += indentEnd + ')\n'
        return s
      } else if (toPrint instanceof Boolean) {
        var bool = 'false'
        if (bool === true) {
          bool = 'true'
        }
        return bool + '\n'
      } else {
        return (toPrint + '\n')
      }
    }
539002
public void println(int i) throws IOException
    {       
        if(this._listener!= null &&  !checkIfCalledFromWLonError()){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())    
                Tr.debug(tc, "non blocking println int , WriteListener enabled: " + this._listener);
            this.println_NonBlocking(Integer.toString(i));
        }
        else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())    
                Tr.debug(tc, "println int");
            super.println(i);
        }
    }
1159127
public static void print(Object o) throws IOException {
		OutputStreamWriter w=new OutputStreamWriter(System.out,"UTF-8");
		print(o, w, true);
		w.flush();
	}
208852
public void printIndent() throws IOException
  {
    _startLine = false;

    for (int i = 0; i < _indentDepth; i++)
      _os.print(' ');

    _lastCr = false;
  }
555891
public void print(String s) throws IOException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        { // 306998.15
            Tr.debug(tc, "print --> " + s);
        }
        if (!_hasWritten && obs != null)
        {
            _hasWritten = true;
            obs.alertFirstWrite();
        }
        int len = s.length();
        if (limit > -1)
        {
            if (total + len > limit)
            {
                len = (int)(limit - total);
                except = new WriteBeyondContentLengthException();
            }
        }

        int off = 0;
        while (len > 0)
        {
            int n = buf.length - count;
            if (n == 0)
            {
                response.setFlushMode(false);
                flushChars();
                response.setFlushMode(true);
                n = buf.length - count;
            }
            if (n > len)
            {
                n = len;
            }

            s.getChars(off, off + n, buf, count);

            count += n;
            total += n;
            off += n;
            len -= n;
        }
        check();
    }
814598
function print(results) {
  results.map(page => {
    if (page[1] instanceof Error) {
      printHeader('red', page[0])
      console.log(page[1].toString())
    } else {
      page[1].status > 200
        ? printHeader('red', page[0])
        : printHeader('green', page[0])
      printHtml(page[1].data)
    }
  })
}
110387
function print(str, indent, inline) {
        var lines = str.split('\n');

        for(var i=0; i<lines.length; i++) {
            if(lines[i]) {
                if((inline && i > 0) || !inline) {
                    for(var j=0; j<indent; j++) {
                        process.stdout.write(' ');
                    }
                }
            }

            if(i === lines.length-1) {
                process.stdout.write(lines[i]);
            }
            else {
                process.stdout.write(lines[i] + '\n');
            }
        }
    }
1133157
function printNodes(node, indent) {
            indent = indent || 0;

            // This is hacky, but this is just a debugging function anyway
            function print(str, indent, inline) {
                var lines = str.split("\n");

                for (var i = 0; i < lines.length; i++) {
                    if (lines[i]) {
                        if ((inline && i > 0) || !inline) {
                            for (var j = 0; j < indent; j++) {
                                util.print(" ");
                            }
                        }
                    }

                    if (i === lines.length - 1) {
                        util.print(lines[i]);
                    } else {
                        util.puts(lines[i]);
                    }
                }
            }

            print(node.typename + ": ", indent);

            if (node instanceof NodeList) {
                print('\n');
                lib.each(node.children, function(n) {
                    printNodes(n, indent + 2);
                });
            } else if (node instanceof CallExtension) {
                print(node.extName + '.' + node.prop);
                print('\n');

                if (node.args) {
                    printNodes(node.args, indent + 2);
                }

                if (node.contentArgs) {
                    lib.each(node.contentArgs, function(n) {
                        printNodes(n, indent + 2);
                    });
                }
            } else {
                var nodes = null;
                var props = null;

                node.iterFields(function(val, field) {
                    if (val instanceof Node) {
                        nodes = nodes || {};
                        nodes[field] = val;
                    } else {
                        props = props || {};
                        props[field] = val;
                    }
                });

                if (props) {
                    print(util.inspect(props, true, null) + '\n', null, true);
                } else {
                    print('\n');
                }

                if (nodes) {
                    for (var k in nodes) {
                        printNodes(nodes[k], indent + 2);
                    }
                }

            }
        }
1076235
@Override
    public int print(
        ChronoDisplay formattable,
        Appendable buffer,
        AttributeQuery attributes,
        Set<ElementPosition> positions, // optional
        boolean quickPath
    ) throws IOException {

        if (quickPath && this.optPrinter) {
            attributes = ChronoFormatter.class.cast(this.printer).getAttributes();
        }

        // special optimization avoiding double conversion from Moment to ZonalDateTime
        if (this.passThroughZDT && (formattable instanceof ZonalDateTime) && (positions == null)) {
            ChronoFormatter<?> cf = (ChronoFormatter<?>) this.printer;
            cf.print(formattable, buffer, attributes, false);
            return Integer.MAX_VALUE; // unknown number of printed characters
        }

        V value = formattable.get(this.element);
        StringBuilder collector = new StringBuilder();

        if ((positions != null) && (buffer instanceof CharSequence)) {
            int offset = ((CharSequence) buffer).length();

            if (this.printer instanceof ChronoFormatter) {
                ChronoFormatter<?> cf = ChronoFormatter.class.cast(this.printer);
                Set<ElementPosition> result = print(cf, value, collector, attributes);
                Set<ElementPosition> set = new LinkedHashSet<>();
                for (ElementPosition ep : result) {
                    set.add(
                        new ElementPosition(
                            ep.getElement(),
                            offset + ep.getStartIndex(),
                            offset + ep.getEndIndex()));
                }
                positions.addAll(set);
            } else {
                this.printer.print(value, collector, attributes);
            }

            positions.add(
                new ElementPosition(
                    this.element,
                    offset,
                    offset + collector.length()));
        } else {
            this.printer.print(value, collector, attributes);
        }

        buffer.append(collector);
        return collector.length();

    }
32209
private void prettyPrint(Node<K, V> n) {
    if (n.left != null) {
      prettyPrint(n.left);
    }
    System.out.println(n);
    if (n.right != null) {
      prettyPrint(n.right);
    }
  }