Class NSData
java.lang.Object
com.dd.plist.NSObject
com.dd.plist.NSData
- All Implemented Interfaces:
Cloneable, Comparable<NSObject>
-
Field Summary
FieldsFields inherited from class NSObject
ASCII_LINE_LENGTH, NEWLINE -
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) Generates the ASCII representation of this object.protected voidtoASCIIGnuStep(StringBuilder ascii, int level) Generates the ASCII representation of this object in the GnuStep format.(package private) voidGenerates the binary representation of the object.Converts this NSObject into an equivalent object of the Java Runtime Environment.(package private) voidtoXML(StringBuilder xml, int level) Generates the XML representation of the object (without XML headers or enclosing plist-tags).Methods inherited from class NSObject
assignIDs, fromJavaObject, indent, toJavaObject, toXMLPropertyList
-
Field Details
-
bytes
private final byte[] bytes
-
-
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
-
toXML
Description copied from class:NSObjectGenerates the XML representation of the object (without XML headers or enclosing plist-tags).- Specified by:
toXMLin classNSObject- Parameters:
xml- TheStringBuilderonto which the XML representation is appended.level- The indentation level of the object.
-
toBinary
Description copied from class:NSObjectGenerates the binary representation of the object.- Specified by:
toBinaryin classNSObject- Parameters:
out- The output stream to serialize the object to.- Throws:
IOException- If an I/O error occurs while writing to the stream or the object structure contains data that cannot be saved.
-
toASCII
Description copied from class:NSObjectGenerates the ASCII representation of this object. The generated ASCII representation does not end with a newline. Complies with the Old-Style ASCII Property Lists definition.- Specified by:
toASCIIin classNSObject- Parameters:
ascii- TheStringBuilderonto which the ASCII representation is appended.level- The indentation level of the object.
-
toASCIIGnuStep
Description copied from class:NSObjectGenerates the ASCII representation of this object in the GnuStep format. The generated ASCII representation does not end with a newline.- Specified by:
toASCIIGnuStepin classNSObject- Parameters:
ascii- TheStringBuilderonto which the ASCII representation is appended.level- The indentation level of the object.
-