public PlistSerializer() { this(new NSDictionary()); }
@Override public NSDictionary clone() { NSDictionary clone = new NSDictionary(); for(Entry<String, NSObject> entry : this.dict.entrySet()) { clone.dict.put(entry.getKey(), entry.getValue() != null ? entry.getValue().clone() : null); } return clone; }
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(); }
private static NSDictionary fromMap(Map<?, ?> map) { NSDictionary result = new NSDictionary(); for (Map.Entry entry : map.entrySet()) { if (!(entry.getKey() instanceof String)) { throw new IllegalArgumentException("Maps need a String key for mapping to NSDictionary."); } result.put((String) entry.getKey(), fromJavaObject(entry.getValue())); } return result; }
@Override public void setMapForKey(final Map<String, String> value, final String key) { final NSDictionary list = new NSDictionary(); for(Map.Entry<String, String> entry : value.entrySet()) { list.put(entry.getKey(), entry.getValue()); } dict.put(key, list); }
private static NSDictionary fromPojo(Object object, Class<?> objClass) { NSDictionary result = new NSDictionary();
public byte[] encoded() { try { NSDictionary dict = new NSDictionary(); dict.put("escrowedKeys", new NSData(escrowedKeys)); dict.put("deviceUuid", new NSString(deviceUuid.toString())); dict.put("deviceHardWareId", new NSString(deviceHardWareId)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PropertyListParser.saveAsBinary(dict, baos); return baos.toByteArray(); } catch (IOException ex) { throw new IllegalStateException(ex); } }
String type = n.getNodeName(); if (type.equals("dict")) { NSDictionary dict = new NSDictionary(); List<Node> children = filterElementNodes(n.getChildNodes()); for (int i = 0; i < children.size(); i += 2) {
public static NSObject toNsObject(JsonObject o) { NSDictionary dict = new NSDictionary(); o.forEach((k,v) -> { if(v.isObject()) { dict.put(k, toNsObject(v.asObject())); } else if(v.isArray()) { dict.put(k, toNsObject(v.asArray())); } else { dict.put(k, toNsObject(v.asPrimitive())); } }); return dict; }
NSDictionary dict = new NSDictionary(); while (!this.accept(DICTIONARY_END_TOKEN)) {
int contentOffset = lengthAndOffset[1]; NSDictionary dict = new NSDictionary(); for (int i = 0; i < length; i++) { int keyRef = (int) parseUnsignedInt(this.bytes, offset + contentOffset + i * this.objectRefSize, offset + contentOffset + (i + 1) * this.objectRefSize);