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


Java ExtendedJSONObject.get方法代码示例

本文整理汇总了Java中org.mozilla.gecko.sync.ExtendedJSONObject.get方法的典型用法代码示例。如果您正苦于以下问题:Java ExtendedJSONObject.get方法的具体用法?Java ExtendedJSONObject.get怎么用?Java ExtendedJSONObject.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mozilla.gecko.sync.ExtendedJSONObject的用法示例。


在下文中一共展示了ExtendedJSONObject.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initFromEnvelope

import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
public void initFromEnvelope(CryptoRecord envelope) {
  ExtendedJSONObject p = envelope.payload;
  this.guid = envelope.guid;
  checkGUIDs(p);

  this.collection    = envelope.collection;
  this.lastModified  = envelope.lastModified;

  final Object del = p.get("deleted");
  if (del instanceof Boolean) {
    this.deleted = (Boolean) del;
  } else {
    this.initFromPayload(p);
  }

}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:17,代码来源:Record.java

示例2: limitObsoleteIds

import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
/**
 * We want cleaning up documents on the server to be best effort. Purge badly
 * formed IDs and cap the number of times we try to delete so that the queue
 * doesn't take too long.
 */
public void limitObsoleteIds() {
  ExtendedJSONObject ids = getObsoleteIds();

  Set<String> keys = new HashSet<String>(ids.keySet()); // Avoid invalidating an iterator.
  for (String key : keys) {
    Object o = ids.get(key);
    if (!(o instanceof Long)) {
      continue;
    }
    if ((Long) o > HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID) {
      ids.put(key, HealthReportConstants.DELETION_ATTEMPTS_PER_OBSOLETE_DOCUMENT_ID);
    }
  }
  setObsoleteIds(ids);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:21,代码来源:ObsoleteDocumentTracker.java

示例3: tabFromJSONObject

import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
public static Tab tabFromJSONObject(JSONObject o) throws NonArrayJSONException {
  ExtendedJSONObject obj = new ExtendedJSONObject(o);
  String title      = obj.getString("title");
  String icon       = obj.getString("icon");
  JSONArray history = obj.getArray("urlHistory");

  // Last used is inexplicably a string in seconds. Most of the time.
  long lastUsed = 0;
  Object lU = obj.get("lastUsed");
  if (lU instanceof Number) {
    lastUsed = ((Long) lU) * 1000L;
  } else if (lU instanceof String) {
    try {
      lastUsed = Long.parseLong((String) lU, 10) * 1000L;
    } catch (NumberFormatException e) {
      Logger.debug(TabsRecord.LOG_TAG, "Invalid number format in lastUsed: " + lU);
    }
  }
  return new Tab(title, icon, history, lastUsed);
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:21,代码来源:TabsRecord.java

示例4: initFromPayload

import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
@Override
protected void initFromPayload(ExtendedJSONObject payload) {
  this.histURI = (String) payload.get("histUri");
  this.title   = (String) payload.get("title");
  try {
    this.visits = payload.getArray("visits");
  } catch (NonArrayJSONException e) {
    Logger.error(LOG_TAG, "Got non-array visits in history record " + this.guid, e);
    this.visits = new JSONArray();
  }
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:12,代码来源:HistoryRecord.java

示例5: decryptPayload

import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
/**
 * Helper method for doing actual decryption.
 *
 * Input: JSONObject containing a valid payload (cipherText, IV, HMAC),
 * KeyBundle with keys for decryption. Output: byte[] clearText
 *
 * @throws CryptoException
 * @throws UnsupportedEncodingException
 */
private byte[] decryptPayload(ExtendedJSONObject payload, KeyBundle keybundle)
    throws CryptoException, UnsupportedEncodingException {

  String sCiphertext = (String) payload.get(Constants.JSON_KEY_CIPHERTEXT);
  String sIv = (String) payload.get(Constants.JSON_KEY_IV);
  String sHmac = (String) payload.get(Constants.JSON_KEY_HMAC);

  byte[] ciphertext = Utils.decodeBase64(sCiphertext);
  byte[] iv = Utils.decodeBase64(sIv);
  byte[] hmac = Utils.hex2Byte(sHmac);

  CryptoInfo decrypted = CryptoInfo.decrypt(ciphertext, iv, hmac, keybundle);
  return decrypted.getMessage();
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:24,代码来源:DecryptDataStage.java

示例6: initFromPayload

import org.mozilla.gecko.sync.ExtendedJSONObject; //导入方法依赖的package包/类
@Override
public void initFromPayload(ExtendedJSONObject payload) {
  clientName = (String) payload.get("clientName");
  try {
    tabs = tabsFrom(payload.getArray("tabs"));
  } catch (NonArrayJSONException e) {
    // Oh well.
    tabs = new ArrayList<Tab>();
  }
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:11,代码来源:TabsRecord.java


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