當前位置: 首頁>>代碼示例>>Java>>正文


Java InvalidProtocolBufferException.printStackTrace方法代碼示例

本文整理匯總了Java中com.google.protobuf.InvalidProtocolBufferException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java InvalidProtocolBufferException.printStackTrace方法的具體用法?Java InvalidProtocolBufferException.printStackTrace怎麽用?Java InvalidProtocolBufferException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.protobuf.InvalidProtocolBufferException的用法示例。


在下文中一共展示了InvalidProtocolBufferException.printStackTrace方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: unpackByteArrayPacket

import com.google.protobuf.InvalidProtocolBufferException; //導入方法依賴的package包/類
@Override
public IObject unpackByteArrayPacket(ByteArrayPacket byteArrayPacket) {
    int opCode = byteArrayPacket.getOpCode();
    IObject cObject = CObject.newInstance();
    switch (SystemRequest.get(opCode)) {
        case USER_LOGIN_PB:
            try {
                PBSystem.CS_USER_CONNECT_TO_SERVER login = PBSystem.CS_USER_CONNECT_TO_SERVER.parseFrom(byteArrayPacket.getRawData());
                String name = login.getName();
                String params = login.getParams();
                cObject.putUtfString("name", name);
                cObject.putUtfString("params", params);
                return cObject;
            } catch (InvalidProtocolBufferException e) {
                e.printStackTrace();
            }
            break;
        default:
            break;
    }
    return cObject;
}
 
開發者ID:zerosoft,項目名稱:CodeBroker,代碼行數:23,代碼來源:ProtobuffSystemProtocolCodec.java

示例2: valueToString

import com.google.protobuf.InvalidProtocolBufferException; //導入方法依賴的package包/類
@Nullable
private String valueToString(Value v) throws IOException {
  if (strictCast() && !v.getValueTypeCase().equals(ValueTypeCase.STRING_VALUE)) {
    return null;
  }

  switch (v.getValueTypeCase()) {
    case STRING_VALUE:
      return v.getStringValue();
    case INTEGER_VALUE:
      return Long.toString(v.getIntegerValue());
    case DOUBLE_VALUE:
      return Double.toString(v.getDoubleValue());
    case BOOLEAN_VALUE:
      return Boolean.toString(v.getBooleanValue());
    case TIMESTAMP_VALUE:
      return valueToTimestamp(v);
    case NULL_VALUE:
      return null;
    case BLOB_VALUE:
      return valueToBytes(v);
    case ARRAY_VALUE:
      ArrayList<String> arr = new ArrayList<>();
      for (Value av: v.getArrayValue().getValuesList()) {
        arr.add(valueToString(av));
      }
      return Transport.getJsonFactory().toString(arr);
    case ENTITY_VALUE:
      try {
        return JsonFormat.printer()
            .usingTypeRegistry(TypeRegistry.newBuilder()
                .add(Entity.getDescriptor())
                .build())
            .omittingInsignificantWhitespace()
            .print(v.getEntityValue());
      } catch (InvalidProtocolBufferException e) {
        e.printStackTrace();
        return null;
      }
    case GEO_POINT_VALUE:
      return valueToGeopoint(v);
    case KEY_VALUE:
      return keyToString(v.getKeyValue());
    default:
      throw new IllegalArgumentException(
          "ValueType Case not handled: " + v.getValueTypeCase());
  }
}
 
開發者ID:cobookman,項目名稱:teleport,代碼行數:49,代碼來源:EntityBQTransform.java

示例3: collect

import com.google.protobuf.InvalidProtocolBufferException; //導入方法依賴的package包/類
@Override
public StreamObserver<UpstreamSegment> collect(final StreamObserver<Downstream> responseObserver) {
    return new StreamObserver<UpstreamSegment>() {
        public void onNext(UpstreamSegment value) {
            try {
                TraceSegmentObject traceSegmentObject = TraceSegmentObject.parseFrom(value.getSegment());
                Segment.SegmentBuilder segmentBuilder = Segment.SegmentBuilder.newBuilder(traceSegmentObject.getTraceSegmentId());
                logger.debug("Receive segment: Application[{}], TraceSegmentId[{}]",
                    traceSegmentObject.getApplicationId(),
                    traceSegmentObject.getTraceSegmentId());

                for (SpanObject spanObject : traceSegmentObject.getSpansList()) {
                    Segment.SpanBuilder spanBuilder = Segment.SpanBuilder.newBuilder(spanObject.getOperationName()).parentSpanId(spanObject.getParentSpanId())
                        .spanId(spanObject.getSpanId()).componentId(spanObject.getComponentId()).componentName(spanObject.getComponent())
                        .spanLayer(spanObject.getSpanLayer().toString()).endTime(spanObject.getEndTime())
                        .startTime(spanObject.getStartTime()).spanType(spanObject.getSpanType().toString())
                        .peer(spanObject.getPeer()).peerId(spanObject.getPeerId()).operationId(spanObject.getOperationNameId());

                    for (LogMessage logMessage : spanObject.getLogsList()) {
                        spanBuilder.logEvent(logMessage.getDataList());
                    }

                    for (KeyWithStringValue tags : spanObject.getTagsList()) {
                        spanBuilder.tags(tags.getKey(), tags.getValue());
                    }

                    segmentBuilder.addSpan(spanBuilder.build());
                }

                for (TraceSegmentReference ref : traceSegmentObject.getRefsList()) {
                    Segment.SegmentRef segmentRef = Segment.SegmentRefBuilder.newBuilder(ref).build();
                    segmentBuilder.addRefs(segmentRef);
                }

                ValidateData.INSTANCE.getSegmentItem().addSegmentItem(traceSegmentObject.getApplicationId(), segmentBuilder.build());
            } catch (InvalidProtocolBufferException e) {
                e.printStackTrace();
            }
        }

        public void onError(Throwable t) {

        }

        public void onCompleted() {
            responseObserver.onNext(Downstream.getDefaultInstance());
            responseObserver.onCompleted();
        }
    };
}
 
開發者ID:SkywalkingTest,項目名稱:skywalking-mock-collector,代碼行數:51,代碼來源:MockTraceSegmentService.java


注:本文中的com.google.protobuf.InvalidProtocolBufferException.printStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。