Java Code Examples for com.google.ipc.invalidation.util.Bytes#EMPTY_BYTES

The following examples show how to use com.google.ipc.invalidation.util.Bytes#EMPTY_BYTES . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Client.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 2
Source File: Client.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 3
Source File: ChannelCommon.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 4
Source File: AndroidChannel.java    From 365browser with Apache License 2.0 6 votes vote down vote up
private AddressedAndroidMessage(String clientKey,
    Bytes message) {
  int hazzerBits = 0;
  if (clientKey != null) {
    hazzerBits |= 0x1;
    this.clientKey = clientKey;
  } else {
    this.clientKey = "";
  }
  if (message != null) {
    hazzerBits |= 0x2;
    this.message = message;
  } else {
    this.message = Bytes.EMPTY_BYTES;
  }
  this.__hazzerBits = hazzerBits;
}
 
Example 5
Source File: AndroidListenerProtocol.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 6
Source File: AndroidListenerProtocol.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 7
Source File: AndroidListenerProtocol.java    From 365browser with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example 8
Source File: ClientProtocol.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private InvalidationP(com.google.ipc.invalidation.ticl.proto.ClientProtocol.ObjectIdP objectId,
    Boolean isKnownVersion,
    Long version,
    Bytes payload,
    Boolean isTrickleRestart) throws ValidationArgumentException {
  int hazzerBits = 0;
  required("object_id", objectId);
  this.objectId = objectId;
  required("is_known_version", isKnownVersion);
  this.isKnownVersion = isKnownVersion;
  required("version", version);
  nonNegative("version", version);
  this.version = version;
  if (payload != null) {
    hazzerBits |= 0x1;
    this.payload = payload;
  } else {
    this.payload = Bytes.EMPTY_BYTES;
  }
  if (isTrickleRestart != null) {
    hazzerBits |= 0x2;
    this.isTrickleRestart = isTrickleRestart;
  } else {
    this.isTrickleRestart = true;
  }
  this.__hazzerBits = hazzerBits;
  check(isKnownVersion || (isTrickleRestart == null || isTrickleRestart),
      "is_trickle_restart required if not is_known_version");
}
 
Example 9
Source File: ClientProtocol.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private ClientHeader(com.google.ipc.invalidation.ticl.proto.ClientProtocol.ProtocolVersion protocolVersion,
    Bytes clientToken,
    com.google.ipc.invalidation.ticl.proto.ClientProtocol.RegistrationSummary registrationSummary,
    Long clientTimeMs,
    Long maxKnownServerTimeMs,
    String messageId,
    Integer clientType) throws ValidationArgumentException {
  int hazzerBits = 0;
  required("protocol_version", protocolVersion);
  this.protocolVersion = protocolVersion;
  if (clientToken != null) {
    hazzerBits |= 0x1;
    nonEmpty("client_token", clientToken);
    this.clientToken = clientToken;
  } else {
    this.clientToken = Bytes.EMPTY_BYTES;
  }
  this.registrationSummary = registrationSummary;
  required("client_time_ms", clientTimeMs);
  nonNegative("client_time_ms", clientTimeMs);
  this.clientTimeMs = clientTimeMs;
  required("max_known_server_time_ms", maxKnownServerTimeMs);
  nonNegative("max_known_server_time_ms", maxKnownServerTimeMs);
  this.maxKnownServerTimeMs = maxKnownServerTimeMs;
  if (messageId != null) {
    hazzerBits |= 0x2;
    nonEmpty("message_id", messageId);
    this.messageId = messageId;
  } else {
    this.messageId = "";
  }
  if (clientType != null) {
    hazzerBits |= 0x4;
    this.clientType = clientType;
  } else {
    this.clientType = 0;
  }
  this.__hazzerBits = hazzerBits;
}
 
Example 10
Source File: ClientProtocol.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private TokenControlMessage(Bytes newToken) {
  int hazzerBits = 0;
  if (newToken != null) {
    hazzerBits |= 0x1;
    this.newToken = newToken;
  } else {
    this.newToken = Bytes.EMPTY_BYTES;
  }
  this.__hazzerBits = hazzerBits;
}