net.sf.plist
Class NSData

java.lang.Object
  extended by net.sf.plist.NSObject
      extended by net.sf.plist.NSData

public class NSData
extends NSObject

Represents a binary blob.

In this implementation, a primitive byte array or a ByteArrayInputStream is used to represent the NSData.

See Also:
ByteArrayInputStream

Constructor Summary
NSData(byte[] theData)
          Constructor.
 
Method Summary
 byte[] data()
          Return the contents of this object as primitive array.
 byte[] getValue()
          Get the unmodifiable value of this object.
 ByteArrayInputStream stream()
          Get a ByteArrayInputStream which can be used to read the contents of this object.
 
Methods inherited from class net.sf.plist.NSObject
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NSData

public NSData(byte[] theData)
Constructor.

Parameters:
theData - value of the new object
Method Detail

getValue

public byte[] getValue()
Get the unmodifiable value of this object. For performance reasons, it's recommended to use stream() instead.

Specified by:
getValue in class NSObject
Returns:
the value of this object
See Also:
data()

stream

public ByteArrayInputStream stream()
Get a ByteArrayInputStream which can be used to read the contents of this object.

Returns:
the ByteArrayInputStream

data

public byte[] data()

Return the contents of this object as primitive array.
Because the array is copied to keep this object immutable, it's recommended to use stream() instead.

Returns:
the array