/*
(non-Javadoc)

@see org.restcomm.ss7.management.console.Console#print(java.lang.String)
960256
@Override
    public void print(String line) {
        try {
            console.pushToConsole(line);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
1125147
public void printQuery(final Query query) {
	if (query != null) {
	    final String[] cols = query.getColumns();
	    final int rows = query.getRowCount();
	    System.out.println("[Query:" + query.getName() + "]");
	    for (int i = 0; i < cols.length; i++) {
		if (i > 0) System.out.print(", ");
		System.out.print(cols[i]);
	    }
	    System.out.println();

	    for (int row = 1; row <= rows; row++) {
		for (int col = 1; col <= cols.length; col++) {
		    if (col > 1) System.out.print(", ");
		    System.out.print(escapeString(query.getData(row, col)));
		}
		System.out.println();
	    }
	}
    }
273416
public void println(String s) throws IOException
    {
        if(this._listener!= null &&  !checkIfCalledFromWLonError()){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())    
                Tr.debug(tc, "non blocking println String , WriteListener enabled: " + this._listener);
            if(s!=null){
                this.println_NonBlocking(s);
            }            
        }
        else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())    
                Tr.debug(tc, "println String");
            super.println(s);
        }
    }
497495
public final void print() {
    System.out.println("=========");
    print_impl(-99,NO_KEY,_val_1);
    _chm.print();
    System.out.println("=========");
  }
1160162
public static void print(String name, List<?> list) {
		JK.line();
		print(String.format("List (%s):", name));
		int index = 1;
		for (Object object : list) {
			JK.print(String.format("\t%d) %s", index++, object));
		}
		JK.line();
	}
836284
public void print() {
    Iterator<String> iter = getKeys();
    while (iter.hasNext()) {
      String key = iter.next();
      log.info(key + " = " + getRawString(key));
    }
  }
476869
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
            value = {"VA_FORMAT_STRING_USES_NEWLINE"},
            justification = "We don't want platform specific"
    )
    public static void printThreadInfo(PrintWriter writer, ThreadInfo t, ThreadMXBean mbean) {
        long cpuPercentage;
        try {
            long cpuTime = mbean.getThreadCpuTime(t.getThreadId());
            long threadUserTime = mbean.getThreadUserTime(t.getThreadId());
            cpuPercentage = (cpuTime == 0) ? 0: 100 * threadUserTime / cpuTime;
        } catch (UnsupportedOperationException x) {
            SupportLogFormatter.printStackTrace(x, writer);
            cpuPercentage = 0;
        }
        writer.printf("\"%s\" id=%d (0x%x) state=%s cpu=%d%%",
                t.getThreadName(),
                t.getThreadId(),
                t.getThreadId(),
                t.getThreadState(),
                cpuPercentage);
        final LockInfo lock = t.getLockInfo();
        if (lock != null && t.getThreadState() != Thread.State.BLOCKED) {
            writer.printf("\n    - waiting on <0x%08x> (a %s)",
                    lock.getIdentityHashCode(),
                    lock.getClassName());
            writer.printf("\n    - locked <0x%08x> (a %s)",
                    lock.getIdentityHashCode(),
                    lock.getClassName());
        } else if (lock != null && t.getThreadState() == Thread.State.BLOCKED) {
            writer.printf("\n    - waiting to lock <0x%08x> (a %s)",
                    lock.getIdentityHashCode(),
                    lock.getClassName());
        }

        if (t.isSuspended()) {
            writer.print(" (suspended)");
        }

        if (t.isInNative()) {
            writer.print(" (running in native)");
        }

        writer.println();
        if (t.getLockOwnerName() != null) {
            writer.printf("      owned by \"%s\" id=%d (0x%x)\n",
                    t.getLockOwnerName(),
                    t.getLockOwnerId(),
                    t.getLockOwnerId());
        }

        final StackTraceElement[] elements = t.getStackTrace();
        final MonitorInfo[] monitors = t.getLockedMonitors();

        for (int i = 0; i < elements.length; i++) {
            final StackTraceElement element = elements[i];
            writer.printf("    at %s\n", element);
            for (int j = 1; j < monitors.length; j++) {
                final MonitorInfo monitor = monitors[j];
                if (monitor.getLockedStackDepth() == i) {
                    writer.printf("      - locked %s\n", monitor);
                }
            }
        }
        writer.println();

        final LockInfo[] locks = t.getLockedSynchronizers();
        if (locks.length > 0) {
            writer.printf("    Locked synchronizers: count = %d\n", locks.length);
            for (LockInfo l : locks) {
                writer.printf("      - %s\n", l);
            }
            writer.println();
        }
    }
194596
public void print(java.io.PrintWriter printWriter)
    {
        printWriter.println("ObjectManager"
                            + "(String)");
        printWriter.println();
        objectManagerState.logOutput.print(printWriter);
    }
1236326
public static void println(String message) {
        synchronized (logSync) {
            if (logWriter != null) {
                logWriter.println(message);

                // automatic flushing is never enabled, so we must do it ourselves
                logWriter.flush();
            }
        }
    }
169950
@Deprecated
    public void print(String data)
        throws IOException, IllegalStateException {
        LOG.trace("enter HttpConnection.print(String)");
        write(EncodingUtil.getBytes(data, "ISO-8859-1"));
    }
1200258
public void print(CharSequence charSequence) {
        try {
            consoleReader.println(charSequence);
            consoleReader.flush();
        } catch (IOException e) {
            throw new IllegalStateException("Can't write to console", e);
        }
    }
25068
@Override
    public void print(char c) throws IOException {
	boolean isWS = Character.isWhitespace(c);
	if (isWS) {
	    if (isFirstChar) // ignore all WS before non-WS content
		return;
	    if (c == CHAR_RETURN) // ignore Carriage-Return chars
		return;
	    if (sb.length() > 0) {
		printBuffer(); // buffer should never contain WS so flush it
		lastChar = (c == CHAR_NL) ? CHAR_NL : c;
		super.print(lastChar);
		return;
	    }
	}

	isFirstChar = false;
	if (c == CHAR_GT && sb.length() > 0) printBuffer(); // buffer should never contain ">" so flush it

	if (isWS || !addToBuffer(c)) {
	    if (depthSum == 0) { // we're not in a WS-preserving tag; suppress whitespace
		if (isWS) { // this char is WS
		    if (lastChar == CHAR_NL) // lastChar was NL; discard this WS char
			return;
		    if (c != CHAR_NL) { // this WS char is not NL
			if (Character.isWhitespace(lastChar)) return; // lastChar was WS but Not NL; discard this WS char
		    }
		}
	    }
	    lastChar = c; // remember c as lastChar and write it to output stream
	    super.print(c);
	}
    }
942856
static void print(Object object,java.io.PrintWriter printWriter) {
    if (object instanceof Printable) {
      ((Printable)object).print(printWriter);
    } else {
      printWriter.print(object);
    } // if (object instanceof Printable).

  }
435587
public static void printTrace(String str) {
        String  trace = System.getenv("ApiTrace");
        if (trace!=null) {
            if (trace.equals("true")) {
                System.out.println(str);
            }
        }

    }
744129
public void print(String value) throws IOException
  {
    if(value!=null) {
        this.output.write(value.getBytes(), 0, value.length());        
    }
  }
774141
public void printLenString(String v)
        throws IOException
    {
        if (SIZE < _offset + 16)
            flushBuffer();

        if (v == null) {
            _buffer[_offset++] = (byte) (0);
            _buffer[_offset++] = (byte) (0);
        }
        else {
            int len = v.length();
            _buffer[_offset++] = (byte) (len >> 8);
            _buffer[_offset++] = (byte) (len);

            printString(v, 0, len);
        }
    }
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();
    }