Comments (4)
I have added Cloneable support in 7927465
from dd-plist.
Here's the solution I made for Kotlin:
private fun NSDictionary.deepClone() : NSDictionary {
return NSObject.fromJavaObject(this.toJavaObject()) as NSDictionary
}
from dd-plist.
Awkward Java solution I've been using:
public static <T extends NSObject> T copy(T object) {
try {
byte[] bs = encode(object);
return (T) PropertyListParser.parse(bs);
} catch (IOException | ClassCastException | PropertyListFormatException | ParseException
| ParserConfigurationException | SAXException ex) {
throw new AssertionError(ex);
}
}
public static byte[] encode(NSObject object) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PropertyListParser.saveAsBinary(object, baos);
return baos.toByteArray();
} catch (IOException ex) {
throw new AssertionError(ex);
}
}
from dd-plist.
Thanks!
from dd-plist.
Related Issues (20)
- PropertyListParser.determineType can only detect UTF-8 BOM HOT 3
- ASCIIPropertyListParser fails to read file that contains only comment
- add support for NSKeyedArchiver
- OutOfMemoryError parsing a small plist file HOT 4
- Various undeclared exceptions with fuzzed input HOT 2
- Various undeclared exceptions with fuzzed input - Part 2 HOT 2
- Cyclic references in binary property list cause StackOverflowError HOT 1
- Parsing of ASCII and XML property lists can cause IllegalArgumentException
- Illegal property list content should not cause exceptions other than PropertyListFormatException HOT 1
- NSDictionary with NULL as key value cause NullReferenceException in BinaryPropertyListParser HOT 1
- Adding NULL to an NSSet causes a NullReferenceException
- Adding a UID to a NSSet causes a ClassCastException
- NSArray to typed array with polymorphism HOT 2
- Binary property list parser does not check object offsets and lengths correctly
- NSNumber parser fails for "+infinity" and "-infinity" HOT 1
- Add support for Java Platform Module System (JPMS) HOT 1
- How to make PList 'date' format key start with uppercase HOT 1
- ParseException errorOffset from ASCIIPropertyListParser::parseQuotedString is offset by the length of the quoted string HOT 1
- Add location information to NSObject nodes HOT 4
- Add parent relationship to NSObject HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dd-plist.