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


Java PropertyListParser类代码示例

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


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

示例1: doPairSetupPin1

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
private PairSetupPin1Response doPairSetupPin1(Socket socket) throws Exception {
    byte[] pairSetupPinRequestData = AuthUtils.createPList(new HashMap<String, String>() {{
        put("method", "pin");
        put("user", clientId);
    }});

    byte[] pairSetupPin1ResponseBytes = AuthUtils.postData(socket, "/pair-setup-pin", "application/x-apple-binary-plist", pairSetupPinRequestData);

    NSDictionary pairSetupPin1Response = (NSDictionary) PropertyListParser.parse(pairSetupPin1ResponseBytes);
    if (pairSetupPin1Response.containsKey("pk") && pairSetupPin1Response.containsKey("salt")) {
        byte[] pk = ((NSData) pairSetupPin1Response.get("pk")).bytes();
        byte[] salt = ((NSData) pairSetupPin1Response.get("salt")).bytes();
        return new PairSetupPin1Response(pk, salt);
    }
    throw new Exception();
}
 
开发者ID:funtax,项目名称:AirPlayAuth,代码行数:17,代码来源:AirPlayAuth.java

示例2: reloadBrowserList

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
static void reloadBrowserList(ArrayList<Browser> browserList) {

        NSArray root = new NSArray(browserList.size());
        for (int i = 0; i < browserList.size(); i++) {
            NSDictionary browser = new NSDictionary();
            browser.put(FIELD_NAME_BROWSER, browserList.get(i).getName());
            browser.put(FIELD_NAME_CALL, browserList.get(i).getCall());
            browser.put(FIELD_NAME_PRIVATE_CALL, browserList.get(i).getIncognitoCall());
            root.setValue(i, browser);
        }

        try {
            log.debug("Browser list location: " + ApplicationConstants.DEFAULT_LIST_LOCATION);
            File file = new File(ApplicationConstants.DEFAULT_LIST_LOCATION);
            PropertyListParser.saveAsXML(root, file);
        } catch (IOException e) {
            log.warn("Can not create .webloc file", e);
        }
    }
 
开发者ID:benchdoos,项目名称:WeblocOpener,代码行数:20,代码来源:BrowserManager.java

示例3: takeUrl

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
/**
 * Takes URL from <code>.webloc</code> file
 *
 * @param file File <code>.webloc</code>
 * @return String - URL in file
 * @see File
 */
public static String takeUrl(File file) throws Exception {
    if (!file.exists()) {
        throw new IllegalArgumentException("File does not exist, path: " + file);
    }
    if (file.isDirectory()) {
        throw new IllegalArgumentException("File can not be a directory, path: " + file);
    }

    log.debug("Got file: " + file);
    NSDictionary rootDict = (NSDictionary) PropertyListParser.parse(file);
    String url = rootDict.objectForKey("URL").toString();
    log.info("Got URL: [" + url + "] from file: " + file);

    return url;
}
 
开发者ID:benchdoos,项目名称:WeblocOpener,代码行数:23,代码来源:UrlsProceed.java

示例4: profileFirstLevelPlistEntries

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
public static void profileFirstLevelPlistEntries(File targetFile, File profileFile, ProfilingUtilMode mode) throws IOException {
    logger.info("Profiling '"+targetFile.getAbsolutePath()+"'...");
    logger.info("  initial md5={}", CommonUtil.getMD5Hex(targetFile));
    BackupUtil.backupFile(targetFile);
    NSDictionary baseDict  = PlistUtil.getRootDictionary(targetFile);
    NSDictionary profDict  = PlistUtil.getRootDictionary(profileFile);
    NSDictionary rsltDict = new NSDictionary();
    for (Map.Entry<String, NSObject> baseEntry : baseDict.entrySet()) {
        if (profDict.containsKey(baseEntry.getKey())) {
            logger.info("  Replacing key '"+baseEntry.getKey()+"' with value '"+profDict.get(baseEntry.getKey())+"'");
            rsltDict.put(baseEntry.getKey(), profDict.get(baseEntry.getKey()));
        } else {
            rsltDict.put(baseEntry.getKey(), baseEntry.getValue());
        }
    }
    if (mode == ProfilingUtilMode.UPDATE_AND_ADD) {
        for (Map.Entry<String, NSObject> profEntry : profDict.entrySet()) {
            if (!rsltDict.containsKey(profEntry.getKey())) {
                logger.info("  Adding key '"+profEntry.getKey()+"' with value '"+profDict.get(profEntry.getKey())+"'");
                rsltDict.put(profEntry.getKey(), profEntry.getValue());
            }
        }
    }
    PropertyListParser.saveAsXML(rsltDict, targetFile.getAbsoluteFile());
    logger.info("  current md5={}", CommonUtil.getMD5Hex(targetFile));
}
 
开发者ID:ctco,项目名称:gradle-mobile-plugin,代码行数:27,代码来源:ProfilingUtil.java

示例5: updateRootPlistPreferenceSpecifiersKeyDefaultValue

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
public static void updateRootPlistPreferenceSpecifiersKeyDefaultValue(File plistFile, String keyToUpdate, String valueToSet) throws IOException {
    BackupUtil.backupFile(plistFile);
    NSDictionary rootDict  = PlistUtil.getRootDictionary(plistFile);
    boolean plistModified = false;
    for (Map.Entry<String, NSObject> subRootEntry : rootDict.entrySet()) {
        if ("PreferenceSpecifiers".equals(subRootEntry.getKey())
                && subRootEntry.getValue() instanceof NSArray
                && "com.dd.plist.NSArray".equals(subRootEntry.getValue().getClass().getCanonicalName())) {
            NSObject[] psArray = ((NSArray)subRootEntry.getValue()).getArray();
            NSDictionary psDict = (NSDictionary)psArray[0];
            for (Map.Entry<String, NSObject> psEntry : psDict.entrySet()) {
                if (keyToUpdate.equals(psEntry.getKey())) {
                    psEntry.setValue(new NSString(valueToSet));
                    plistModified = true;
                    logger.info("  Replacing key '{}' with value '{}'", psEntry.getKey(), valueToSet);
                }
            }
        }
    }
    if (plistModified) {
        PropertyListParser.saveAsXML(rootDict, plistFile.getAbsoluteFile());
        logger.info("  current md5={}", CommonUtil.getMD5Hex(plistFile));
    }
}
 
开发者ID:ctco,项目名称:gradle-mobile-plugin,代码行数:25,代码来源:ProfilingUtil.java

示例6: callPlist

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
private NSDictionary callPlist(String startDate, String endDate) {
    HttpUrl url;
    if (!TextUtils.isEmpty(startDate) && !TextUtils.isEmpty(endDate)) {
        url = HttpUrl.parse(String.format(BuildConfig.PLISTARCHIVURL, startDate, endDate));
    } else {
        url = HttpUrl.parse(BuildConfig.PLISTURL);
    }
    okhttp3.Call call = OkHttp3Helper.getInstance(getContext())
                                     .getCall(url,
                                              RequestHelper.getInstance(getContext())
                                                           .getOkhttp3RequestBody());
    try {
        okhttp3.Response response = call.execute();
        if (response.isSuccessful()) {
            return (NSDictionary) PropertyListParser.parse(response.body()
                                                                   .bytes());
        }
        throw new IOException(response.body()
                                      .string());
    } catch (Exception e) {
        Timber.e(e);
    }
    return null;
}
 
开发者ID:die-tageszeitung,项目名称:tazapp-android,代码行数:25,代码来源:SyncJob.java

示例7: Plist

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
public Plist(InputStream is, boolean parseIndex) throws IOException, PropertyListFormatException, ParseException,
        ParserConfigurationException, SAXException {

    root = (NSDictionary) PropertyListParser.parse(is);

    is.close();

    archiveUrl = PlistHelper.getString(root, KEY_ARCHIVEURL);
    bookId = PlistHelper.getString(root, KEY_BOOKID);
    resource = PlistHelper.getString(root, KEY_RESOURCE);
    if (!TextUtils.isEmpty(resource)) {
        resource = resource.replace(".res", "");
    }
    minVersion = PlistHelper.getString(root, KEY_MINVERSION);
    version = PlistHelper.getString(root, KEY_VERSION);

    parseHashVals();

    if (parseIndex) {
        parseSources();
        parseToplinks();
    }

}
 
开发者ID:die-tageszeitung,项目名称:tazapp-android,代码行数:25,代码来源:Paper.java

示例8: from

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
public static Optional<InflatableData> from(byte[] bs) {
    InflatableData data;
    try {
        NSDictionary parse = (NSDictionary) PropertyListParser.parse(bs);
        byte[] escrowedKeys = ((NSData) parse.get("escrowedKeys")).bytes();
        UUID deviceUuid = UUID.fromString(((NSString) parse.get("deviceUuid")).getContent());
        String deviceHardWareId = ((NSString) parse.get("deviceHardWareId")).getContent();
        data = new InflatableData(escrowedKeys, deviceUuid, deviceHardWareId);

    } catch (ClassCastException | IllegalArgumentException | IOException | NullPointerException
            | PropertyListFormatException | ParseException | ParserConfigurationException | SAXException ex) {
        logger.warn("-- from() - exception: ", ex);
        data = null;
    }
    return Optional.ofNullable(data);
}
 
开发者ID:horrorho,项目名称:InflatableDonkey,代码行数:17,代码来源:InflatableData.java

示例9: handleEntity

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
@Override
public T handleEntity(HttpEntity entity) throws IOException {
    NSObject nsObject;

    try {
        // Avoiding PropertyListParser#parse(InputStream) as the current Maven build (1.16) can bug out.
        nsObject = PropertyListParser.parse(EntityUtils.toByteArray(entity));

    } catch (PropertyListFormatException | ParseException | ParserConfigurationException | SAXException ex) {
        throw new BadDataException("failed to parse property list", ex);
    }

    if (to.isAssignableFrom(nsObject.getClass())) {
        return to.cast(nsObject);
    }

    throw new BadDataException("failed to cast property list: " + nsObject.getClass());
}
 
开发者ID:horrorho,项目名称:InflatableDonkey,代码行数:19,代码来源:PropertyListResponseHandler.java

示例10: checkAutomaticPlistEntries

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
protected void checkAutomaticPlistEntries(RuleType ruleType) throws Exception {
  ruleType.scratchTarget(scratch, INFOPLIST_ATTR, RuleType.OMIT_REQUIRED_ATTR);

  ConfiguredTarget target = getConfiguredTarget("//x:x");
  Artifact automaticInfoplist = getBinArtifact("plists/x-automatic.plist", target);
  FileWriteAction automaticInfoplistAction =
      (FileWriteAction) getGeneratingAction(automaticInfoplist);

  NSDictionary foundAutomaticEntries =
      (NSDictionary)
          PropertyListParser.parse(
              automaticInfoplistAction.getFileContents().getBytes(Charset.defaultCharset()));

  assertThat(foundAutomaticEntries.keySet())
      .containsExactly(
          "UIDeviceFamily",
          "DTPlatformName",
          "DTSDKName",
          "CFBundleSupportedPlatforms",
          "MinimumOSVersion");
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:22,代码来源:ObjcRuleTestCase.java

示例11: doPairSetupPin2

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
private PairSetupPin2Response doPairSetupPin2(Socket socket, final byte[] publicClientValueA, final byte[] clientEvidenceMessageM1) throws Exception {
    byte[] pairSetupPinRequestData = AuthUtils.createPList(new HashMap<String, byte[]>() {{
        put("pk", publicClientValueA);
        put("proof", clientEvidenceMessageM1);
    }});

    byte[] pairSetupPin2ResponseBytes = AuthUtils.postData(socket, "/pair-setup-pin", "application/x-apple-binary-plist", pairSetupPinRequestData);

    NSDictionary pairSetupPin2Response = (NSDictionary) PropertyListParser.parse(pairSetupPin2ResponseBytes);
    if (pairSetupPin2Response.containsKey("proof")) {
        byte[] proof = ((NSData) pairSetupPin2Response.get("proof")).bytes();
        return new PairSetupPin2Response(proof);
    }
    throw new Exception();
}
 
开发者ID:funtax,项目名称:AirPlayAuth,代码行数:16,代码来源:AirPlayAuth.java

示例12: doPairSetupPin3

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
private PairSetupPin3Response doPairSetupPin3(Socket socket, final byte[] sessionKeyHashK) throws Exception {

        MessageDigest sha512Digest = MessageDigest.getInstance("SHA-512");
        sha512Digest.update("Pair-Setup-AES-Key".getBytes(StandardCharsets.UTF_8));
        sha512Digest.update(sessionKeyHashK);
        byte[] aesKey = Arrays.copyOfRange(sha512Digest.digest(), 0, 16);

        sha512Digest.update("Pair-Setup-AES-IV".getBytes(StandardCharsets.UTF_8));
        sha512Digest.update(sessionKeyHashK);
        byte[] aesIV = Arrays.copyOfRange(sha512Digest.digest(), 0, 16);

        int lengthB;
        int lengthA = lengthB = aesIV.length - 1;
        for (; lengthB >= 0 && 256 == ++aesIV[lengthA]; lengthA = lengthB += -1) ;

        Cipher aesGcm128Encrypt = Cipher.getInstance("AES/GCM/NoPadding");
        SecretKeySpec secretKey = new SecretKeySpec(aesKey, "AES");
        aesGcm128Encrypt.init(Cipher.ENCRYPT_MODE, secretKey, new GCMParameterSpec(128, aesIV));
        final byte[] aesGcm128ClientLTPK = aesGcm128Encrypt.doFinal(authKey.getAbyte());

        byte[] pairSetupPinRequestData = AuthUtils.createPList(new HashMap<String, byte[]>() {{
            put("epk", Arrays.copyOfRange(aesGcm128ClientLTPK, 0, aesGcm128ClientLTPK.length - 16));
            put("authTag", Arrays.copyOfRange(aesGcm128ClientLTPK, aesGcm128ClientLTPK.length - 16, aesGcm128ClientLTPK.length));
        }});

        byte[] pairSetupPin3ResponseBytes = AuthUtils.postData(socket, "/pair-setup-pin", "application/x-apple-binary-plist", pairSetupPinRequestData);

        NSDictionary pairSetupPin3Response = (NSDictionary) PropertyListParser.parse(pairSetupPin3ResponseBytes);

        if (pairSetupPin3Response.containsKey("epk") && pairSetupPin3Response.containsKey("authTag")) {
            byte[] epk = ((NSData) pairSetupPin3Response.get("epk")).bytes();
            byte[] authTag = ((NSData) pairSetupPin3Response.get("authTag")).bytes();

            return new PairSetupPin3Response(epk, authTag);
        }
        throw new Exception();
    }
 
开发者ID:funtax,项目名称:AirPlayAuth,代码行数:38,代码来源:AirPlayAuth.java

示例13: createPList

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
static byte[] createPList(Map<String, ? extends Object> properties) throws IOException {
    ByteArrayOutputStream plistOutputStream = new ByteArrayOutputStream();
    NSDictionary root = new NSDictionary();
    for (Map.Entry<String, ? extends Object> property : properties.entrySet()) {
        root.put(property.getKey(), property.getValue());
    }
    PropertyListParser.saveAsBinary(root, plistOutputStream);
    return plistOutputStream.toByteArray();
}
 
开发者ID:funtax,项目名称:AirPlayAuth,代码行数:10,代码来源:AuthUtils.java

示例14: fromPath

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
/**
 * Parses the content of a plist file as UTF-8 encoded XML.
 *
 * @throws PlistParseException - if there is an error parsing the content.
 */
public static NSObject fromPath(Path plist) {
  try {
    return PropertyListParser.parse(Files.readAllBytes(plist));
  } catch (ParserConfigurationException
      | ParseException
      | PropertyListFormatException
      | IOException
      | SAXException e) {
    throw new PlistParseException(e);
  }
}
 
开发者ID:google,项目名称:ios-device-control,代码行数:17,代码来源:PlistParser.java

示例15: parse

import com.dd.plist.PropertyListParser; //导入依赖的package包/类
public static Entry parse(File file) {
    LogUtil.log("EntryUtil", "parse(File)");

    try {

        NSDictionary rootDict = (NSDictionary) PropertyListParser.parse(file);
        LogUtil.log("EntryUtil", "NSDictionary: " + rootDict.toXMLPropertyList());
        return fromDictionary(rootDict);

    } catch (Exception e) {
        LogUtil.e("EntryUtil", "Exception in parse: ", e);
        return null;
    }
}
 
开发者ID:timothymiko,项目名称:narrate-android,代码行数:15,代码来源:EntryHelper.java


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