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.
|
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.
|
fromJavaObject, toJavaObject, 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()
NSObjectprotected void toASCII(StringBuilder ascii, int level)
NSObjecttoASCII in class NSObjectascii - The StringBuilder onto which the ASCII representation is appended.level - The indentation level of the object.protected void toASCIIGnuStep(StringBuilder ascii, int level)
NSObjecttoASCIIGnuStep in class NSObjectascii - The StringBuilder onto which the ASCII representation is appended.level - The indentation level of the object.Copyright © 2022. All rights reserved.