本文整理汇总了Java中android.util.Printer类的典型用法代码示例。如果您正苦于以下问题:Java Printer类的具体用法?Java Printer怎么用?Java Printer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Printer类属于android.util包,在下文中一共展示了Printer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dump
import android.util.Printer; //导入依赖的package包/类
@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(" mCapsLock=" + mCapsLock);
p.println(" mComposing=" + mComposing.toString());
p.println(" mPredictionOn=" + mPredictionOn);
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);
}
示例2: dump
import android.util.Printer; //导入依赖的package包/类
@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());
p.println(mDictionaryFacilitator.dump(this /* context */));
// TODO: Dump all settings values
}
示例3: dump
import android.util.Printer; //导入依赖的package包/类
public void dump(Printer printer, String prefix) {
printer.println("------crash begin------");
printer.println("crash time:" + DateUtils.format(System.currentTimeMillis(), DateUtils.YMD_HMS));
printer.println(prefix + "appName=" + mAppName);
printer.println(prefix + "appVersionCode=" + mAppVersionCode);
printer.println(prefix + "appVersionName=" + mAppVersionName);
printer.println(prefix + "sdkVersion=" + mSDKVersion);
printer.println(prefix + "deviceName=" + mDeviceName);
printer.println(prefix + "deviceId=" + mDeviceId);
printer.println(prefix + "osVersion=" + mOsVersion);
printer.println(prefix + "osName=" + mOsName);
printer.println(prefix + "arch=" + mArch);
printer.println(prefix + "product=" + mProduct);
printer.println(prefix + "cpuCoreCount=" + mCpuCoreCount);
printer.println(prefix + "memorySize=" + memorySize);
printer.println(prefix + "threadName=" + mThreadName);
printer.println(prefix + "errorMessage=" + mErrorMessage);
printer.println("------crash end------");
}
示例4: dump
import android.util.Printer; //导入依赖的package包/类
public void dump(Printer pw, String prefix) {
/*pw = PrefixPrinter.create(pw, prefix);
pw.println(this.toString());
pw.println("mRun=" + mRun);
pw.println("mThread=" + mThread);
pw.println("mQueue=" + ((mQueue != null) ? mQueue : "(null"));
if (mQueue != null) {
synchronized (mQueue) {
long now = SystemClock.uptimeMillis();
Message msg = mQueue.mMessages;
int n = 0;
while (msg != null) {
pw.println(" Message " + n + ": " + msg.toString(now));
n++;
msg = msg.next;
}
pw.println("(Total messages: " + n + ")");
}
}*/
}
示例5: dump
import android.util.Printer; //导入依赖的package包/类
public void dump(Printer printer) {
printer.println(" Prepared statement cache:");
Map<String, PreparedStatement> cache = snapshot();
if (!cache.isEmpty()) {
int i = 0;
for (Map.Entry<String, PreparedStatement> entry : cache.entrySet()) {
PreparedStatement statement = entry.getValue();
if (statement.mInCache) { // might be false due to a race with entryRemoved
String sql = entry.getKey();
printer.println(" " + i + ": statementPtr=0x"
+ Long.toHexString(statement.mStatementPtr)
+ ", numParameters=" + statement.mNumParameters
+ ", type=" + statement.mType
+ ", readOnly=" + statement.mReadOnly
+ ", sql=\"" + trimSqlForDisplay(sql) + "\"");
}
i += 1;
}
} else {
printer.println(" <none>");
}
}
示例6: getNetSecConfigResourceId
import android.util.Printer; //导入依赖的package包/类
/** Try to retrieve the Network Security Policy resource ID configured in the App's manifest.
*
* Somewhat convoluted as other means of getting the resource ID involve using private APIs.
*
* @param context
* @return The resource ID for the XML file containing the configured Network Security Policy or
* -1 if no policy was configured in the App's manifest or if we are not running on Android N.
*/
static private int getNetSecConfigResourceId(@NonNull Context context) {
ApplicationInfo info = context.getApplicationInfo();
// Dump the content of the ApplicationInfo, which contains the resource ID on Android N
class NetSecConfigResIdRetriever implements Printer {
private int netSecConfigResourceId = -1;
private final String NETSEC_LINE_FORMAT = "networkSecurityConfigRes=0x";
public void println(String x) {
if (netSecConfigResourceId == -1) {
// Attempt at parsing "networkSecurityConfigRes=0x1234"
if (x.contains(NETSEC_LINE_FORMAT)) {
netSecConfigResourceId =
Integer.parseInt(x.substring(NETSEC_LINE_FORMAT.length()), 16);
}
}
}
private int getNetworkSecurityConfigResId() { return netSecConfigResourceId; }
}
NetSecConfigResIdRetriever retriever = new NetSecConfigResIdRetriever();
info.dump(retriever, "");
return retriever.getNetworkSecurityConfigResId();
}
示例7: dump
import android.util.Printer; //导入依赖的package包/类
@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);
}
示例8: dumpSpans
import android.util.Printer; //导入依赖的package包/类
/**
* 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.
*/
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)");
}
}
示例9: FastPrintWriter
import android.util.Printer; //导入依赖的package包/类
/**
* Constructs a new {@code PrintWriter} with {@code pr} as its target
* printer and a custom buffer size. Because a {@link Printer} is line-base,
* autoflush is always enabled.
*
* @param pr
* the target writer.
* @param bufferLen
* specifies the size of the FastPrintWriter's internal buffer; the
* default is 512.
* @throws NullPointerException
* if {@code pr} is {@code null}.
*/
public FastPrintWriter(Printer pr, int bufferLen) {
super(new DummyWriter(), true);
if (pr == null) {
throw new NullPointerException("pr is null");
}
mBufferLen = bufferLen;
mText = new char[bufferLen];
mBytes = null;
mOutputStream = null;
mWriter = null;
mPrinter = pr;
mAutoFlush = true;
mSeparator = System.lineSeparator();
initDefaultEncoder();
}
示例10: dump
import android.util.Printer; //导入依赖的package包/类
@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 :");
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(" mIsSuggestionsSuggestionsRequested = "
+ settingsValues.isSuggestionsRequested(mDisplayOrientation));
p.println(" mCorrectionEnabled=" + settingsValues.mCorrectionEnabled);
p.println(" isComposingWord=" + mWordComposer.isComposingWord());
p.println(" mSoundOn=" + settingsValues.mSoundOn);
p.println(" mVibrateOn=" + settingsValues.mVibrateOn);
p.println(" mKeyPreviewPopupOn=" + settingsValues.mKeyPreviewPopupOn);
p.println(" inputAttributes=" + settingsValues.mInputAttributes);
}
示例11: dump
import android.util.Printer; //导入依赖的package包/类
@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);
}
示例12: dump
import android.util.Printer; //导入依赖的package包/类
private void dump(Printer printer, boolean verbose) {
synchronized (mLock) {
if (mConnectionPoolLocked != null) {
printer.println("");
// TODO: 17/6/6
// mConnectionPoolLocked.dump(printer, verbose);
}
}
}
示例13: start
import android.util.Printer; //导入依赖的package包/类
/**
* start monitor ui thread
* @author leibing
* @createTime 2017/3/1
* @lastModify 2017/3/1
* @param
* @return
*/
public static void start(){
Looper.getMainLooper().setMessageLogging(new Printer() {
@Override
public void println(String s) {
if (s.startsWith(START)){
LogMonitor.getInstance().startMonitor();
}
if (s.startsWith(END)){
LogMonitor.getInstance().removeMonitor();
}
}
});
}
示例14: dump
import android.util.Printer; //导入依赖的package包/类
public final void dump(Printer pw, String prefix) {
pw.println(prefix + this + " @ " + SystemClock.uptimeMillis());
if (mLooper == null) {
pw.println(prefix + "looper uninitialized");
} else {
mLooper.dump(pw, prefix + " ");
}
}
示例15: dump
import android.util.Printer; //导入依赖的package包/类
/**
* Dumps detailed information about all databases used by the process.
* @param printer The printer for dumping database state.
* @param args Command-line arguments supplied to dumpsys dbinfo
*/
public static void dump(Printer printer, String[] args) {
boolean verbose = false;
for (String arg : args) {
if (arg.equals("-v")) {
verbose = true;
}
}
SQLiteDatabase.dumpAll(printer, verbose);
}