• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Bytes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: StartCommand

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
private StartCommand(Integer clientType,
    Bytes clientName,
    Boolean allowSuppression) {
  int hazzerBits = 0;
  if (clientType != null) {
    hazzerBits |= 0x1;
    this.clientType = clientType;
  } else {
    this.clientType = 0;
  }
  if (clientName != null) {
    hazzerBits |= 0x2;
    this.clientName = clientName;
  } else {
    this.clientName = Bytes.EMPTY_BYTES;
  }
  if (allowSuppression != null) {
    hazzerBits |= 0x4;
    this.allowSuppression = allowSuppression;
  } else {
    this.allowSuppression = false;
  }
  this.__hazzerBits = hazzerBits;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:25,代码来源:AndroidListenerProtocol.java


示例2: create

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
public static InvalidationClientState create(com.google.ipc.invalidation.ticl.proto.Client.RunStateP runState,
    Bytes clientToken,
    Bytes nonce,
    Boolean shouldSendRegistrations,
    Long lastMessageSendTimeMs,
    Boolean isOnline,
    com.google.ipc.invalidation.ticl.proto.JavaClient.ProtocolHandlerState protocolHandlerState,
    com.google.ipc.invalidation.ticl.proto.JavaClient.RegistrationManagerStateP registrationManagerState,
    com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState acquireTokenTaskState,
    com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState regSyncHeartbeatTaskState,
    com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState persistentWriteTaskState,
    com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState heartbeatTaskState,
    com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState batchingTaskState,
    com.google.ipc.invalidation.ticl.proto.Client.PersistentTiclState lastWrittenState,
    com.google.ipc.invalidation.ticl.proto.JavaClient.StatisticsState statisticsState) {
  return new InvalidationClientState(runState, clientToken, nonce, shouldSendRegistrations, lastMessageSendTimeMs, isOnline, protocolHandlerState, registrationManagerState, acquireTokenTaskState, regSyncHeartbeatTaskState, persistentWriteTaskState, heartbeatTaskState, batchingTaskState, lastWrittenState, statisticsState);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:JavaClient.java


示例3: equals

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
/**
 * Overridden for tests which compare listener states to verify that they have been correctly
 * (un)marshalled. We implement equals rather than exposing private data.
 */
@Override
public boolean equals(Object object) {
  if (this == object) {
    return true;
  }

  if (!(object instanceof AndroidListenerState)) {
    return false;
  }

  AndroidListenerState that = (AndroidListenerState) object;

  return (this.isDirty == that.isDirty)
      && (this.requestCodeSeqNum == that.requestCodeSeqNum)
      && (this.desiredRegistrations.size() == that.desiredRegistrations.size())
      && (this.desiredRegistrations.containsAll(that.desiredRegistrations))
      && TypedUtil.<Bytes>equals(this.clientId, that.clientId)
      && equals(this.delayGenerators, that.delayGenerators)
      && equals(this.registrationRetries, that.registrationRetries);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:25,代码来源:AndroidListenerState.java


示例4: RegistrationCommand

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
private RegistrationCommand(Boolean isRegister,
    Collection<com.google.ipc.invalidation.ticl.proto.ClientProtocol.ObjectIdP> objectId,
    Bytes clientId,
    Boolean isDelayed) {
  int hazzerBits = 0;
  if (isRegister != null) {
    hazzerBits |= 0x1;
    this.isRegister = isRegister;
  } else {
    this.isRegister = false;
  }
  this.objectId = optional("object_id", objectId);
  if (clientId != null) {
    hazzerBits |= 0x2;
    this.clientId = clientId;
  } else {
    this.clientId = Bytes.EMPTY_BYTES;
  }
  if (isDelayed != null) {
    hazzerBits |= 0x4;
    this.isDelayed = isDelayed;
  } else {
    this.isDelayed = false;
  }
  this.__hazzerBits = hazzerBits;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:27,代码来源:AndroidListenerProtocol.java


示例5: ServerHeader

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
private ServerHeader(com.google.ipc.invalidation.ticl.proto.ClientProtocol.ProtocolVersion protocolVersion,
    Bytes clientToken,
    com.google.ipc.invalidation.ticl.proto.ClientProtocol.RegistrationSummary registrationSummary,
    Long serverTimeMs,
    String messageId) throws ValidationArgumentException {
  int hazzerBits = 0;
  required("protocol_version", protocolVersion);
  this.protocolVersion = protocolVersion;
  required("client_token", clientToken);
  nonEmpty("client_token", clientToken);
  this.clientToken = clientToken;
  this.registrationSummary = registrationSummary;
  required("server_time_ms", serverTimeMs);
  nonNegative("server_time_ms", serverTimeMs);
  this.serverTimeMs = serverTimeMs;
  if (messageId != null) {
    hazzerBits |= 0x1;
    nonEmpty("message_id", messageId);
    this.messageId = messageId;
  } else {
    this.messageId = "";
  }
  this.__hazzerBits = hazzerBits;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:25,代码来源:ClientProtocol.java


示例6: NetworkEndpointId

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
private NetworkEndpointId(Integer networkAddress,
    Bytes clientAddress,
    Boolean isOffline) {
  int hazzerBits = 0;
  if (networkAddress != null) {
    hazzerBits |= 0x1;
    this.networkAddress = networkAddress;
  } else {
    this.networkAddress = 1;
  }
  if (clientAddress != null) {
    hazzerBits |= 0x2;
    this.clientAddress = clientAddress;
  } else {
    this.clientAddress = Bytes.EMPTY_BYTES;
  }
  if (isOffline != null) {
    hazzerBits |= 0x4;
    this.isOffline = isOffline;
  } else {
    this.isOffline = false;
  }
  this.__hazzerBits = hazzerBits;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:25,代码来源:ChannelCommon.java


示例7: AndroidListenerState

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
private AndroidListenerState(Collection<com.google.ipc.invalidation.ticl.proto.ClientProtocol.ObjectIdP> registration,
    Collection<com.google.ipc.invalidation.ticl.proto.AndroidListenerProtocol.AndroidListenerState.RetryRegistrationState> retryRegistrationState,
    Bytes clientId,
    Integer requestCodeSeqNum,
    Collection<com.google.ipc.invalidation.ticl.proto.AndroidListenerProtocol.AndroidListenerState.ScheduledRegistrationRetry> registrationRetry) {
  int hazzerBits = 0;
  this.registration = optional("registration", registration);
  this.retryRegistrationState = optional("retry_registration_state", retryRegistrationState);
  if (clientId != null) {
    hazzerBits |= 0x1;
    this.clientId = clientId;
  } else {
    this.clientId = Bytes.EMPTY_BYTES;
  }
  if (requestCodeSeqNum != null) {
    hazzerBits |= 0x2;
    this.requestCodeSeqNum = requestCodeSeqNum;
  } else {
    this.requestCodeSeqNum = 0;
  }
  this.registrationRetry = optional("registration_retry", registrationRetry);
  this.__hazzerBits = hazzerBits;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:24,代码来源:AndroidListenerProtocol.java


示例8: PersistentStateBlob

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
private PersistentStateBlob(com.google.ipc.invalidation.ticl.proto.Client.PersistentTiclState ticlState,
    Bytes authenticationCode) {
  int hazzerBits = 0;
  if (ticlState != null) {
    hazzerBits |= 0x1;
    this.ticlState = ticlState;
  } else {
    this.ticlState = com.google.ipc.invalidation.ticl.proto.Client.PersistentTiclState.DEFAULT_INSTANCE;
  }
  if (authenticationCode != null) {
    hazzerBits |= 0x2;
    this.authenticationCode = authenticationCode;
  } else {
    this.authenticationCode = Bytes.EMPTY_BYTES;
  }
  this.__hazzerBits = hazzerBits;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:Client.java


示例9: fromMessageNano

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
static InvalidationClientState fromMessageNano(com.google.protos.ipc.invalidation.NanoJavaClient.InvalidationClientState message) {
  if (message == null) { return null; }
  return new InvalidationClientState(com.google.ipc.invalidation.ticl.proto.Client.RunStateP.fromMessageNano(message.runState),
      Bytes.fromByteArray(message.clientToken),
      Bytes.fromByteArray(message.nonce),
      message.shouldSendRegistrations,
      message.lastMessageSendTimeMs,
      message.isOnline,
      com.google.ipc.invalidation.ticl.proto.JavaClient.ProtocolHandlerState.fromMessageNano(message.protocolHandlerState),
      com.google.ipc.invalidation.ticl.proto.JavaClient.RegistrationManagerStateP.fromMessageNano(message.registrationManagerState),
      com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState.fromMessageNano(message.acquireTokenTaskState),
      com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState.fromMessageNano(message.regSyncHeartbeatTaskState),
      com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState.fromMessageNano(message.persistentWriteTaskState),
      com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState.fromMessageNano(message.heartbeatTaskState),
      com.google.ipc.invalidation.ticl.proto.JavaClient.RecurringTaskState.fromMessageNano(message.batchingTaskState),
      com.google.ipc.invalidation.ticl.proto.Client.PersistentTiclState.fromMessageNano(message.lastWrittenState),
      com.google.ipc.invalidation.ticl.proto.JavaClient.StatisticsState.fromMessageNano(message.statisticsState));
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:JavaClient.java


示例10: sendInitializeMessage

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
/**
 * Sends a message to the server to request a client token.
 *
 * @param applicationClientId application-specific client id
 * @param nonce nonce for the request
 * @param debugString information to identify the caller
 */
void sendInitializeMessage(ApplicationClientIdP applicationClientId, Bytes nonce,
    BatchingTask batchingTask, String debugString) {
  Preconditions.checkState(internalScheduler.isRunningOnThread(), "Not on internal thread");
  if (applicationClientId.getClientType() != clientType) {
    // This condition is not fatal, but it probably represents a bug somewhere if it occurs.
    logger.warning(
        "Client type in application id does not match constructor-provided type: %s vs %s",
        applicationClientId, clientType);
  }

  // Simply store the message in pendingInitializeMessage and send it when the batching task runs.
  InitializeMessage initializeMsg = InitializeMessage.create(clientType, nonce,
      applicationClientId, DigestSerializationType.BYTE_BASED);
  batcher.setInitializeMessage(initializeMsg);
  logger.info("Batching initialize message for client: %s, %s", debugString, initializeMsg);
  batchingTask.ensureScheduled(debugString);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:25,代码来源:ProtocolHandler.java


示例11: PersistentTiclState

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
private PersistentTiclState(Bytes clientToken,
    Long lastMessageSendTimeMs) {
  int hazzerBits = 0;
  if (clientToken != null) {
    hazzerBits |= 0x1;
    this.clientToken = clientToken;
  } else {
    this.clientToken = Bytes.EMPTY_BYTES;
  }
  if (lastMessageSendTimeMs != null) {
    hazzerBits |= 0x2;
    this.lastMessageSendTimeMs = lastMessageSendTimeMs;
  } else {
    this.lastMessageSendTimeMs = 0;
  }
  this.__hazzerBits = hazzerBits;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:Client.java


示例12: createStartIntent

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
/** See specs for {@link InvalidationClient#start}. */
public static Intent createStartIntent(Context context, int clientType, byte[] clientName) {
  Preconditions.checkNotNull(context);
  Preconditions.checkNotNull(clientName);

  final boolean allowSuppression = true;
  return AndroidListenerIntents.createStartIntent(context, clientType,
      Bytes.fromByteArray(clientName), allowSuppression);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:AndroidListener.java


示例13: newAcknowledgeIntent

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
public static Intent newAcknowledgeIntent(byte[] ackHandleData) {
  AckDowncall ackDowncall = AckDowncall.create(new Bytes(ackHandleData));
  Intent intent = new Intent();
  intent.putExtra(CLIENT_DOWNCALL_KEY, ClientDowncall.createWithAck(
      ANDROID_PROTOCOL_VERSION_VALUE, ackDowncall).toByteArray());
  return intent;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:8,代码来源:ProtocolIntents.java


示例14: newCreateClientIntent

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
public static Intent newCreateClientIntent(int clientType, Bytes clientName,
    ClientConfigP config, boolean skipStartForTest) {
  CreateClient createClient =
      CreateClient.create(clientType, clientName, config, skipStartForTest);
  Intent intent = new Intent();
  intent.putExtra(INTERNAL_DOWNCALL_KEY, InternalDowncall.createWithCreateClient(
      ANDROID_PROTOCOL_VERSION_VALUE, createClient).toByteArray());
  return intent;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:10,代码来源:ProtocolIntents.java


示例15: newInvalidateUnknownIntent

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
public static Intent newInvalidateUnknownIntent(ObjectIdP object, AckHandleP ackHandle) {
  Intent intent = new Intent();
  InvalidateUpcall invUpcall =
      InvalidateUpcall.createWithInvalidateUnknown(new Bytes(ackHandle.toByteArray()), object);
  intent.putExtra(LISTENER_UPCALL_KEY, ListenerUpcall.createWithInvalidate(
      ANDROID_PROTOCOL_VERSION_VALUE, invUpcall).toByteArray());
  return intent;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:9,代码来源:ProtocolIntents.java


示例16: newReissueRegistrationsIntent

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
public static Intent newReissueRegistrationsIntent(byte[] prefix, int length) {
  Intent intent = new Intent();
  ReissueRegistrationsUpcall reissueRegistrations =
      ReissueRegistrationsUpcall.create(new Bytes(prefix), length);
  intent.putExtra(LISTENER_UPCALL_KEY, ListenerUpcall.createWithReissueRegistrations(
      ANDROID_PROTOCOL_VERSION_VALUE, reissueRegistrations).toByteArray());
  return intent;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:9,代码来源:ProtocolIntents.java


示例17: createDigestedState

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
/**
 * Returns a {@link AndroidTiclStateWithDigest} containing {@code ticlState} and its computed
 * digest.
 */
private static AndroidTiclStateWithDigest createDigestedState(
    AndroidInvalidationClientImpl ticl) {
  Sha1DigestFunction digester = new Sha1DigestFunction();
  ApplicationClientIdP ticlAppId = ticl.getApplicationClientIdP();
  Metadata metadata = Metadata.create(ticlAppId.getClientType(), ticlAppId.getClientName(),
      ticl.getSchedulingId(), ticl.getConfig());
  AndroidTiclState state = AndroidTiclState.create(ProtocolIntents.ANDROID_PROTOCOL_VERSION_VALUE,
      ticl.marshal(), metadata,
      ((AndroidInternalScheduler) ticl.getResources().getInternalScheduler()).marshal());
  digester.update(state.toByteArray());
  AndroidTiclStateWithDigest verifiedState =
      AndroidTiclStateWithDigest.create(state, new Bytes(digester.getDigest()));
  return verifiedState;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:19,代码来源:TiclStateManager.java


示例18: handleSchedulerEvent

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
/** Handles a request to call a particular recurring task on the Ticl. */
private void handleSchedulerEvent(byte[] schedulerEventBytes) {
  // Parse and validate the request.
  final AndroidSchedulerEvent event;
  try {
    event = AndroidSchedulerEvent.parseFrom(schedulerEventBytes);
  } catch (ValidationException exception) {
    resources.getLogger().warning("Failed parsing SchedulerEvent from %s: %s",
        Bytes.toLazyCompactString(schedulerEventBytes), exception.getMessage());
    return;
  }

  resources.getLogger().fine("Handle scheduler event: %s", event);

  // Restore the appropriate Ticl.
  AndroidInvalidationClientImpl ticl = TiclStateManager.restoreTicl(this, resources);

  // If the Ticl didn't exist, drop the event.
  if (ticl == null) {
    resources.getLogger().fine("Dropping event %s; Ticl state does not exist",
        event.getEventName());
    return;
  }

  // Invoke the appropriate event.
  AndroidInternalScheduler ticlScheduler =
      (AndroidInternalScheduler) resources.getInternalScheduler();
  ticlScheduler.handleSchedulerEvent(event);

  // Save the Ticl state to persistent storage.
  TiclStateManager.saveTicl(this, resources.getLogger(), ticl);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:33,代码来源:TiclService.java


示例19: acknowledge

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
@Override  // InvalidationClient
public void acknowledge(final AckHandle acknowledgeHandle) {
  Preconditions.checkNotNull(acknowledgeHandle);
  Preconditions.checkState(internalScheduler.isRunningOnThread(),
      "Not running on internal thread");

  // Parse and validate the ack handle first.
  AckHandleP ackHandle;
  try {
    ackHandle = AckHandleP.parseFrom(acknowledgeHandle.getHandleData());
  } catch (ValidationException exception) {
    logger.warning("Bad ack handle : %s",
        Bytes.toLazyCompactString(acknowledgeHandle.getHandleData()));
    statistics.recordError(ClientErrorType.ACKNOWLEDGE_HANDLE_FAILURE);
    return;
  }

  // Currently, only invalidations have non-trivial ack handle.
  InvalidationP invalidation = ackHandle.getNullableInvalidation();
  if (invalidation == null) {
    logger.warning("Ack handle without invalidation : %s",
        Bytes.toLazyCompactString(acknowledgeHandle.getHandleData()));
    statistics.recordError(ClientErrorType.ACKNOWLEDGE_HANDLE_FAILURE);
    return;
  }

  // Don't send the payload back.
  if (invalidation.hasPayload()) {
    InvalidationP.Builder builder = invalidation.toBuilder();
    builder.payload = null;
    invalidation = builder.build();
  }
  statistics.recordIncomingOperation(IncomingOperationType.ACKNOWLEDGE);
  protocolHandler.sendInvalidationAck(invalidation, batchingTask);

  // Record that the invalidation has been acknowledged to potentially avoid unnecessary delivery
  // of earlier invalidations for the same object.
  ackCache.recordAck(invalidation);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:40,代码来源:InvalidationClientCore.java


示例20: fromMessageNano

import com.google.ipc.invalidation.util.Bytes; //导入依赖的package包/类
static RegistrationCommand fromMessageNano(com.google.protos.ipc.invalidation.NanoAndroidListenerProtocol.RegistrationCommand message) {
  if (message == null) { return null; }
  List<com.google.ipc.invalidation.ticl.proto.ClientProtocol.ObjectIdP> objectId = new ArrayList<com.google.ipc.invalidation.ticl.proto.ClientProtocol.ObjectIdP>(message.objectId.length);
  for (int i = 0; i < message.objectId.length; i++) {
    objectId.add(com.google.ipc.invalidation.ticl.proto.ClientProtocol.ObjectIdP.fromMessageNano(message.objectId[i]));
  }
  return new RegistrationCommand(message.isRegister,
      objectId,
      Bytes.fromByteArray(message.clientId),
      message.isDelayed);
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:12,代码来源:AndroidListenerProtocol.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Read类代码示例发布时间:2022-05-23
下一篇:
Java GeneralTestEventsProcessor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap