当前位置: 首页>>代码示例>>Java>>正文


Java AndroidNetworkSendRequest类代码示例

本文整理汇总了Java中com.google.protos.ipc.invalidation.AndroidService.AndroidNetworkSendRequest的典型用法代码示例。如果您正苦于以下问题:Java AndroidNetworkSendRequest类的具体用法?Java AndroidNetworkSendRequest怎么用?Java AndroidNetworkSendRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AndroidNetworkSendRequest类属于com.google.protos.ipc.invalidation.AndroidService包,在下文中一共展示了AndroidNetworkSendRequest类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleOutboundMessage

import com.google.protos.ipc.invalidation.AndroidService.AndroidNetworkSendRequest; //导入依赖的package包/类
/**
 * Handles a request to send a message to the data center. Validates the message and sends
 * an intent to the application to obtain an auth token to use on the HTTP request to the
 * data center.
 */
private void handleOutboundMessage(byte[] sendRequestBytes) {
  // Parse and validate the send request.
  final AndroidNetworkSendRequest sendRequest;
  try {
     sendRequest = AndroidNetworkSendRequest.parseFrom(sendRequestBytes);
  } catch (InvalidProtocolBufferException exception) {
    logger.warning("Failed parsing AndroidNetworkSendRequest from %s: %s",
        sendRequestBytes, exception);
    return;
  }
  if (!validator.isNetworkSendRequestValid(sendRequest)) {
    logger.warning("Ignoring invalid send request: %s", sendRequest);
    return;
  }

  // Request an auth token from the application to use when sending the message.
  byte[] message = sendRequest.getMessage().toByteArray();
  requestAuthTokenForMessage(message, null);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:25,代码来源:AndroidMessageSenderService.java

示例2: newOutboundMessageIntent

import com.google.protos.ipc.invalidation.AndroidService.AndroidNetworkSendRequest; //导入依赖的package包/类
/** Returns a new intent encoding a message to send to the data center. */
public static Intent newOutboundMessageIntent(byte[] message) {
  byte[] payloadBytes = AndroidNetworkSendRequest.newBuilder()
      .setVersion(ANDROID_PROTOCOL_VERSION_VALUE)
      .setMessage(ByteString.copyFrom(message)).build().toByteArray();
  return new Intent().putExtra(OUTBOUND_MESSAGE_KEY, payloadBytes);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:8,代码来源:ProtocolIntents.java

示例3: toCompactString

import com.google.protos.ipc.invalidation.AndroidService.AndroidNetworkSendRequest; //导入依赖的package包/类
/** Appends a description of the given {@code request} to the given {@code builder}. */
public static TextBuilder toCompactString(TextBuilder builder,
    AndroidNetworkSendRequest request) {
  if (request == null) {
    return builder;
  }
  return builder.append(ProtocolIntents.OUTBOUND_MESSAGE_KEY).append("(")
      .append(request.getMessage()).append(")");
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:AndroidStrings.java

示例4: hasField

import com.google.protos.ipc.invalidation.AndroidService.AndroidNetworkSendRequest; //导入依赖的package包/类
/** Returns whether {@code field} is present in {@code message}. */
@Override
@SuppressWarnings("unchecked")
public boolean hasField(MessageLite rawMessage, Descriptor field) {
  Preconditions.checkNotNull(rawMessage);
  Preconditions.checkNotNull(field);
  AndroidNetworkSendRequest message = (AndroidNetworkSendRequest) rawMessage;
  if (field == VERSION) {
    return message.hasVersion();
  }
  if (field == MESSAGE) {
    return message.hasMessage();
  }
  throw new IllegalArgumentException("Bad descriptor: " + field);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:16,代码来源:AndroidServiceAccessor.java

示例5: getField

import com.google.protos.ipc.invalidation.AndroidService.AndroidNetworkSendRequest; //导入依赖的package包/类
/** Returns the {@code field} from {@code message}. */
@Override
@SuppressWarnings("unchecked")
public Object getField(MessageLite rawMessage, Descriptor field) {
  Preconditions.checkNotNull(rawMessage);
  Preconditions.checkNotNull(field);
  AndroidNetworkSendRequest message = (AndroidNetworkSendRequest) rawMessage;
  if (field == VERSION) {
    return message.getVersion();
  }
  if (field == MESSAGE) {
    return message.getMessage();
  }
  throw new IllegalArgumentException("Bad descriptor: " + field);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:16,代码来源:AndroidServiceAccessor.java

示例6: isNetworkSendRequestValid

import com.google.protos.ipc.invalidation.AndroidService.AndroidNetworkSendRequest; //导入依赖的package包/类
/** Returns whether {@code request} has a valid set of fields with valid values. */
public boolean isNetworkSendRequestValid(AndroidNetworkSendRequest request) {
  return checkMessage(request, InternalInfos.ANDROID_NETWORK_SEND_REQUEST);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:5,代码来源:AndroidIntentProtocolValidator.java

示例7: tryParseExtra

import com.google.protos.ipc.invalidation.AndroidService.AndroidNetworkSendRequest; //导入依赖的package包/类
/** Appends a description of any known extra or appends 'UNKNOWN' if none are recognized. */
private static boolean tryParseExtra(TextBuilder builder, Intent intent)
    throws InvalidProtocolBufferException {
  byte[] data;

  data = intent.getByteArrayExtra(ProtocolIntents.SCHEDULER_KEY);
  if (data != null) {
    AndroidSchedulerEvent schedulerEvent = AndroidSchedulerEvent.parseFrom(data);
    toCompactString(builder, schedulerEvent);
    return true;
  }

  data = intent.getByteArrayExtra(ProtocolIntents.OUTBOUND_MESSAGE_KEY);
  if (data != null) {
    AndroidNetworkSendRequest outboundMessage = AndroidNetworkSendRequest.parseFrom(data);
    toCompactString(builder, outboundMessage);
    return true;
  }

  data = intent.getByteArrayExtra(ProtocolIntents.LISTENER_UPCALL_KEY);
  if (data != null) {
    ListenerUpcall upcall = ListenerUpcall.parseFrom(data);
    toCompactString(builder, upcall);
    return true;
  }

  data = intent.getByteArrayExtra(ProtocolIntents.INTERNAL_DOWNCALL_KEY);
  if (data != null) {
    InternalDowncall internalDowncall = InternalDowncall.parseFrom(data);
    toCompactString(builder, internalDowncall);
    return true;
  }

  data = intent.getByteArrayExtra(ProtocolIntents.CLIENT_DOWNCALL_KEY);
  if (data != null) {
    ClientDowncall clientDowncall = ClientDowncall.parseFrom(data);
    toCompactString(builder, clientDowncall);
    return true;
  }

  // Didn't recognize any intents.
  return false;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:44,代码来源:AndroidStrings.java


注:本文中的com.google.protos.ipc.invalidation.AndroidService.AndroidNetworkSendRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。