public class NSData extends NSObject
Constructor and Description |
---|
NSData(byte[] bytes)
Creates the NSData object from the binary representation of it.
|
NSData(File file)
Creates a NSData object from a file.
|
NSData(String base64)
Creates a NSData object from its textual representation, which is a Base64 encoded amount of bytes.
|
Modifier and Type | Method and Description |
---|---|
byte[] |
bytes()
The bytes contained in this NSData object.
|
boolean |
equals(Object obj) |
String |
getBase64EncodedData()
Gets the Base64 encoded data contained in this NSData object.
|
void |
getBytes(ByteBuffer buf,
int length)
Loads the bytes from this NSData object into a byte buffer
|
void |
getBytes(ByteBuffer buf,
int rangeStart,
int rangeStop)
Loads the bytes from this NSData object into a byte buffer
|
int |
hashCode() |
int |
length()
Gets the amount of data stored in this object.
|
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.
|
toJavaObject, toXMLPropertyList, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrap, wrapSerialized
public NSData(byte[] bytes)
bytes
- The raw data contained in the NSData object.public NSData(String base64) throws IOException
base64
- The Base64 encoded contents of the NSData object.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 datalength
- The amount of data to copypublic void getBytes(ByteBuffer buf, int rangeStart, int rangeStop)
buf
- The byte buffer which will contain the datarangeStart
- The start indexrangeStop
- The stop indexpublic String getBase64EncodedData()
String
.protected void toASCII(StringBuilder ascii, int level)
NSObject
protected void toASCIIGnuStep(StringBuilder ascii, int level)
NSObject
toASCIIGnuStep
in class NSObject
ascii
- The StringBuilder onto which the ASCII representation is appended.level
- The indentation level of the object.Copyright © 2014. All Rights Reserved.