Constructor and Description |
---|
NSData(byte[] theData)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.io.ByteArrayInputStream |
getValue()
Get the unmodifiable value of this object.
|
boolean |
isTrue()
Return whether or not the value evaluates to true.
|
byte[] |
toBytes()
Return the contents of this object as primitive array.
Because the array is copied to keep this object immutable, it's recommended to use toStream() instead. |
double |
toDouble()
Return the value as a double.
|
long |
toLong()
Get the length of the content in bytes.
|
java.io.ByteArrayInputStream |
toStream()
Get a
ByteArrayInputStream which can be used to read the contents of this object. |
java.lang.String |
toString()
Returns an unformatted hexadecimal representation of the content.
|
public NSData(byte[] theData)
theData
- value of the new objectpublic java.io.ByteArrayInputStream getValue()
getValue
in class NSObject
toStream()
public java.io.ByteArrayInputStream toStream()
ByteArrayInputStream
which can be used to read the contents of this object.
This is the most cost-efficient way to retrieve the value contained in an NSData
object.public byte[] toBytes()
Return the contents of this object as primitive array.
Because the array is copied to keep this object immutable,
it's recommended to use toStream()
instead.
public boolean isTrue()
Return whether or not the value evaluates to true.
A value returns to true if and only if
NSBoolean
type NSBoolean.TRUE
NSString
which has a length greater than zero and does not equal "NO" or "False" (case insensitive)NSNumber
greater than 0NSCollection
which contains more than zero elementsNSDate
NSData
with a length greater than 0public java.lang.String toString()
public long toLong()