Class NSData
java.lang.Object
com.dd.plist.NSObject
com.dd.plist.NSData
- All Implemented Interfaces:
Cloneable,Comparable<NSObject>
The NSData class is a wrapper for a byte buffer.
- Author:
- Daniel Dreibrodt
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]bytes()Returns the bytes contained in this instance.clone()Creates and returns a deep copy of this instance.intbooleanGets the Base64 encoded data contained in this instance.voidgetBytes(ByteBuffer buf, int length) Copies data from this instance into the specified buffer.voidgetBytes(ByteBuffer buf, int rangeStart, int rangeStop) Copies data from this instance into the specified buffer.inthashCode()intlength()Returns the number of bytes stored in this instance.protected voidtoASCII(StringBuilder ascii, int level) protected voidtoASCIIGnuStep(StringBuilder ascii, int level) Converts this NSObject into an equivalent object of the Java Runtime Environment.Methods inherited from class com.dd.plist.NSObject
fromJavaObject, getLocationInformation, indent, toJavaObject, toXMLPropertyList
-
Constructor Details
-
NSData
public NSData(byte[] bytes) Creates a new NSData instance with the specified content.- Parameters:
bytes- The data content.
-
NSData
Creates a new NSData instance with the specified Base64 encoded content.- Parameters:
base64- The Base64 encoded data content.- Throws:
IOException- When the given string is not a proper Base64 formatted string.
-
NSData
Creates a new NSData instance with the specified file as content.- Parameters:
file- The file containing the data.- Throws:
FileNotFoundException- If the file could not be found.IOException- If the file could not be read.
-
-
Method Details
-
bytes
public byte[] bytes()Returns the bytes contained in this instance.- Returns:
- The data as bytes
-
length
public int length()Returns the number of bytes stored in this instance.- Returns:
- The number of bytes contained in this object.
-
getBytes
Copies data from this instance into the specified buffer.- Parameters:
buf- The byte buffer which will contain the data.length- The number of bytes to copy.
-
getBytes
Copies data from this instance into the specified buffer.- Parameters:
buf- The byte buffer which will contain the data.rangeStart- The index from which to start copying.rangeStop- The index at which to stop copying.
-
getBase64EncodedData
Gets the Base64 encoded data contained in this instance.- Returns:
- The data as a Base64 encoded
String.
-
equals
-
hashCode
-
clone
-
toJavaObject
Description copied from class:NSObjectConverts this NSObject into an equivalent object of the Java Runtime Environment.NSArrayobjects are converted to arrays.NSDictionaryobjects are converted to objects extending theMapclass.NSSetobjects are converted to objects extending theSetclass.NSNumberobjects are converted to primitive number values (int, long, double or boolean).NSStringobjects are converted toStringobjects.NSDataobjects are converted to byte arrays.NSDateobjects are converted toDateobjects.UIDobjects are converted to byte arrays.
- Specified by:
toJavaObjectin classNSObject- Returns:
- A native java object representing this NSObject's value.
-
compareTo
-
toASCII
-
toASCIIGnuStep
-