public class NSData extends NSObject
| Constructor and Description |
|---|
NSData(byte[] bytes)
Creates a new NSData instance with the specified content.
|
NSData(File file)
Creates a new NSData instance with the specified file as content.
|
NSData(String base64)
Creates a new NSData instance with the specified Base64 encoded content.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
bytes()
Returns the bytes contained in this instance.
|
NSData |
clone()
Creates and returns a deep copy of this instance.
|
int |
compareTo(NSObject o) |
boolean |
equals(Object obj) |
String |
getBase64EncodedData()
Gets the Base64 encoded data contained in this instance.
|
void |
getBytes(ByteBuffer buf,
int length)
Copies data from this instance into the specified buffer.
|
void |
getBytes(ByteBuffer buf,
int rangeStart,
int rangeStop)
Copies data from this instance into the specified buffer.
|
int |
hashCode() |
int |
length()
Returns the number of bytes stored in this instance.
|
protected void |
toASCII(StringBuilder ascii,
int level)
Generates the ASCII representation of this object.
|
protected void |
toASCIIGnuStep(StringBuilder ascii,
int level)
Generates the ASCII representation of this object in the GnuStep format.
|
Object |
toJavaObject()
Converts this NSObject into an equivalent object of the Java Runtime Environment.
|
fromJavaObject, getLocationInformation, indent, toJavaObject, toXMLPropertyListpublic NSData(byte[] bytes)
bytes - The data content.public NSData(String base64) throws IOException
base64 - The Base64 encoded data content.IOException - When the given string is not a proper Base64 formatted string.public NSData(File file) throws IOException
file - The file containing the data.FileNotFoundException - If the file could not be found.IOException - If the file could not be read.public byte[] bytes()
public int length()
public void getBytes(ByteBuffer buf, int length)
buf - The byte buffer which will contain the data.length - The number of bytes to copy.public void getBytes(ByteBuffer buf, int rangeStart, int rangeStop)
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.public String getBase64EncodedData()
String.public NSData clone()
NSObjectpublic Object toJavaObject()
NSObjectNSArray objects are converted to arrays.NSDictionary objects are converted to objects extending the Map class.NSSet objects are converted to objects extending the Set class.NSNumber objects are converted to primitive number values (int, long, double or boolean).NSString objects are converted to String objects.NSData objects are converted to byte arrays.NSDate objects are converted to Date objects.UID objects are converted to byte arrays.toJavaObject in class NSObjectpublic int compareTo(NSObject o)
protected void toASCII(StringBuilder ascii, int level)
NSObjectascii - The StringBuilder onto which the ASCII representation is appended.level - The indentation level of the object.protected void toASCIIGnuStep(StringBuilder ascii, int level)
NSObjectascii - The StringBuilder onto which the ASCII representation is appended.level - The indentation level of the object.Copyright © 2024. All rights reserved.