Java Code Examples for com.google.protobuf.nano.MessageNanoPrinter

Following code examples demonstrate how to use com.google.protobuf.nano.MessageNanoPrinterfrom android. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.google.protobuf.nano.MessageNanoPrinterand various code implementation of this class.

        public void dumpState(String indent) {
            Log.d("FinskyLibrary", indent + "Event {");
            Log.d("FinskyLibrary", indent + "  type=" + typeToString(this.type));
            Log.d("FinskyLibrary", indent + "  timestampMs=" + this.timestampMs);
            Log.d("FinskyLibrary", indent + "  timestamp=" + DateFormat.format("MM-dd hh:mm:ss", this.timestampMs));
            if (this.tag != null) {
                Log.d("FinskyLibrary", indent + "  tag=" + this.tag);
            }
            if (this.libraryUpdate != null) {
                String[] libraryUpdateLines = MessageNanoPrinter.print(this.libraryUpdate).split("\n");
                Log.d("FinskyLibrary", indent + "  libraryUpdate=");
                for (String libraryUpdateLine : libraryUpdateLines) {
                    Log.d("FinskyLibrary", indent + "    " + libraryUpdateLine);
                }
            }
            if (this.volleyError != null) {
                Log.d("FinskyLibrary", indent + "  volleyError=" + this.volleyError);
            }
            Log.d("FinskyLibrary", indent + "}");
        } 


    private void performRequests(List<Account> accounts, int[] finishedReplications, int[] successfulReplications, List<ContentSyncRequestProto> requests, List<com.android.volley.Response.Listener<ContentSyncResponseProto>> responseListeners) {
        if (accounts.size() == 0) {
            handleContentSyncResponse(0, 0, 0);
            return;
        }
        for (int i = 0; i < accounts.size(); i++) {
            Account account = (Account) accounts.get(i);
            if (FinskyLog.DEBUG) {
                Object[] objArr = new Object[1];
                objArr[0] = FinskyLog.scrubPii(account.name);
                FinskyLog.d("ContentSyncRequestProto for account %s:", objArr);
                int len$ = MessageNanoPrinter.print((MessageNano) requests.get(i)).split("\n").length;
                for (int i$ = 0; i$ < len$; i$++) {
                    FinskyLog.d(": %s", arr$[i$]);
                }
            }
            final int[] iArr = finishedReplications;
            final List<Account> list = accounts;
            final int[] iArr2 = successfulReplications;
            this.mVendingApiFactory.getApi(account.name).syncContent((ContentSyncRequestProto) requests.get(i), this.mAdIdProvider, getAccountOrdinal(account), (com.android.volley.Response.Listener) responseListeners.get(i), new ErrorListener() {
                public void onErrorResponse(VolleyError volleyError) {
                    int[] iArr = iArr;
                    iArr[0] = iArr[0] + 1;
                    AppStatesReplicator.this.handleContentSyncResponse(list.size(), iArr[0], iArr2[0]);
                }
            });
        }
    } 

Advertisement
Javadoc
Static helper methods for printing nano protos. @author flynn@google.com Andrew Flynn
Advertisement