Example usage for android.util Printer println

List of usage examples for android.util Printer println

Introduction

In this page you can find the example usage for android.util Printer println.

Prototype

void println(String x);

Source Link

Document

Write a line of text to the output.

Usage

From source file:com.jecelyin.editor.v2.core.text.TextUtils.java

/**
 * Debugging tool to print the spans in a CharSequence.  The output will
 * be printed one span per line.  If the CharSequence is not a Spanned,
 * then the entire string will be printed on a single line.
 *///  www . ja v a  2s.  c om
public static void dumpSpans(CharSequence cs, Printer printer, String prefix) {
    if (cs instanceof Spanned) {
        Spanned sp = (Spanned) cs;
        Object[] os = sp.getSpans(0, cs.length(), Object.class);

        for (int i = 0; i < os.length; i++) {
            Object o = os[i];
            printer.println(prefix + cs.subSequence(sp.getSpanStart(o), sp.getSpanEnd(o)) + ": "
                    + Integer.toHexString(System.identityHashCode(o)) + " " + o.getClass().getCanonicalName()
                    + " (" + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o) + ") fl=#" + sp.getSpanFlags(o));
        }
    } else {
        printer.println(prefix + cs + ": (no spans)");
    }
}

From source file:io.requery.android.database.sqlite.SQLiteConnectionPool.java

/**
 * Dumps debugging information about this connection pool.
 *
 * @param printer The printer to receive the dump, not null.
 * @param verbose True to dump more verbose information.
 *//*from  w ww. j av a 2 s. c  o  m*/
public void dump(Printer printer, boolean verbose) {
    synchronized (mLock) {
        printer.println("Connection pool for " + mConfiguration.path + ":");
        printer.println("  Open: " + mIsOpen);
        printer.println("  Max connections: " + mMaxConnectionPoolSize);

        printer.println("  Available primary connection:");
        if (mAvailablePrimaryConnection != null) {
            mAvailablePrimaryConnection.dump(printer, verbose);
        } else {
            printer.println("<none>");
        }

        printer.println("  Available non-primary connections:");
        if (!mAvailableNonPrimaryConnections.isEmpty()) {
            for (SQLiteConnection connection : mAvailableNonPrimaryConnections) {
                connection.dump(printer, verbose);
            }
        } else {
            printer.println("<none>");
        }

        printer.println("  Acquired connections:");
        if (!mAcquiredConnections.isEmpty()) {
            for (Map.Entry<SQLiteConnection, AcquiredConnectionStatus> entry : mAcquiredConnections
                    .entrySet()) {
                final SQLiteConnection connection = entry.getKey();
                connection.dumpUnsafe(printer, verbose);
                printer.println("  Status: " + entry.getValue());
            }
        } else {
            printer.println("<none>");
        }

        printer.println("  Connection waiters:");
        if (mConnectionWaiterQueue != null) {
            int i = 0;
            final long now = SystemClock.uptimeMillis();
            for (ConnectionWaiter waiter = mConnectionWaiterQueue; waiter != null; waiter = waiter.mNext, i++) {
                printer.println(i + ": waited for " + ((now - waiter.mStartTime) * 0.001f) + " ms - thread="
                        + waiter.mThread + ", priority=" + waiter.mPriority + ", sql='" + waiter.mSql + "'");
            }
        } else {
            printer.println("<none>");
        }
    }
}

From source file:io.requery.android.database.sqlite.SQLiteConnection.java

/**
 * Dumps debugging information about this connection, in the case where the
 * caller might not actually own the connection.
 *
 * This function is written so that it may be called by a thread that does not
 * own the connection.  We need to be very careful because the connection state is
 * not synchronized.//from  ww  w.  j  a  va2  s .  c  o m
 *
 * At worst, the method may return stale or slightly wrong data, however
 * it should not crash.  This is ok as it is only used for diagnostic purposes.
 *
 * @param printer The printer to receive the dump, not null.
 * @param verbose True to dump more verbose information.
 */
void dumpUnsafe(Printer printer, boolean verbose) {
    printer.println("Connection #" + mConnectionId + ":");
    if (verbose) {
        printer.println("  connectionPtr: 0x" + Long.toHexString(mConnectionPtr));
    }
    printer.println("  isPrimaryConnection: " + mIsPrimaryConnection);
    printer.println("  onlyAllowReadOnlyOperations: " + mOnlyAllowReadOnlyOperations);

    mRecentOperations.dump(printer, verbose);

    if (verbose) {
        mPreparedStatementCache.dump(printer);
    }
}

From source file:com.mobiletin.inputmethod.indic.LatinIME.java

@Override
protected void dump(final FileDescriptor fd, final PrintWriter fout, final String[] args) {
    super.dump(fd, fout, args);

    final Printer p = new PrintWriterPrinter(fout);
    p.println("LatinIME state :");
    p.println("  VersionCode = " + ApplicationUtils.getVersionCode(this));
    p.println("  VersionName = " + ApplicationUtils.getVersionName(this));
    final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
    final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1;
    p.println("  Keyboard mode = " + keyboardMode);
    final SettingsValues settingsValues = mSettings.getCurrent();
    p.println(settingsValues.dump());/* w w  w .j  a  v  a  2 s.  co  m*/
    // TODO: Dump all settings values
}

From source file:io.requery.android.database.sqlite.SQLiteDatabase.java

private void dump(Printer printer, boolean verbose) {
    synchronized (mLock) {
        if (mConnectionPoolLocked != null) {
            printer.println("");
            mConnectionPoolLocked.dump(printer, verbose);
        }//  w w  w.  jav  a  2 s  .  c  om
    }
}

From source file:org.distantshoresmedia.keyboard.LatinIME.java

@Override
protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
    super.dump(fd, fout, args);

    final Printer p = new PrintWriterPrinter(fout);
    p.println("LatinIME state :");
    p.println("  Keyboard mode = " + mKeyboardSwitcher.getKeyboardMode());
    p.println("  mComposing=" + mComposing.toString());
    p.println("  mPredictionOnForMode=" + mPredictionOnForMode);
    p.println("  mCorrectionMode=" + mCorrectionMode);
    p.println("  mPredicting=" + mPredicting);
    p.println("  mAutoCorrectOn=" + mAutoCorrectOn);
    p.println("  mAutoSpace=" + mAutoSpace);
    p.println("  mCompletionOn=" + mCompletionOn);
    p.println("  TextEntryState.state=" + TextEntryState.getState());
    p.println("  mSoundOn=" + mSoundOn);
    p.println("  mVibrateOn=" + mVibrateOn);
    p.println("  mPopupOn=" + mPopupOn);
}