Class NSCoder

All Implemented Interfaces:
NSObjectProtocol, ObjCProtocol
Direct Known Subclasses:
NSKeyedArchiver, NSKeyedUnarchiver

public class NSCoder
extends NSObject
  • Constructor Details

  • Method Details

    • getSystemVersion

      public int getSystemVersion()
    • allowsKeyedCoding

      public boolean allowsKeyedCoding()
    • requiresSecureCoding

      public boolean requiresSecureCoding()
    • getAllowedClasses

      public List<ObjCClass> getAllowedClasses()
    • getDecodingFailurePolicy

      public NSDecodingFailurePolicy getDecodingFailurePolicy()
      Since:
      Available in iOS 9.0 and later.
    • getError

      public NSError getError()
      Since:
      Available in iOS 9.0 and later.
    • encodeCGPoint

      public void encodeCGPoint​(String key, CGPoint point)
    • encodeCGSize

      public void encodeCGSize​(String key, CGSize size)
    • encodeCGRect

      public void encodeCGRect​(String key, CGRect rect)
    • encodeCGAffineTransform

      public void encodeCGAffineTransform​(String key, CGAffineTransform transform)
    • encodeUIEdgeInsets

      public void encodeUIEdgeInsets​(String key, UIEdgeInsets insets)
    • encodeUIOffset

      public void encodeUIOffset​(String key, UIOffset offset)
      Since:
      Available in iOS 5.0 and later.
    • decodeCGPoint

      public CGPoint decodeCGPoint​(String key)
    • decodeCGSize

      public CGSize decodeCGSize​(String key)
    • decodeCGRect

      public CGRect decodeCGRect​(String key)
    • decodeCGAffineTransform

      public CGAffineTransform decodeCGAffineTransform​(String key)
    • decodeUIEdgeInsets

      public UIEdgeInsets decodeUIEdgeInsets​(String key)
    • decodeUIOffset

      public UIOffset decodeUIOffset​(String key)
      Since:
      Available in iOS 5.0 and later.
    • encodeCMTime

      public void encodeCMTime​(String key, CMTime time)
      Since:
      Available in iOS 4.0 and later.
    • decodeCMTime

      public CMTime decodeCMTime​(String key)
      Since:
      Available in iOS 4.0 and later.
    • encodeCMTimeRange

      public void encodeCMTimeRange​(String key, CMTimeRange timeRange)
      Since:
      Available in iOS 4.0 and later.
    • decodeCMTimeRange

      public CMTimeRange decodeCMTimeRange​(String key)
      Since:
      Available in iOS 4.0 and later.
    • encodeCMTimeMapping

      public void encodeCMTimeMapping​(String key, CMTimeMapping timeMapping)
      Since:
      Available in iOS 4.0 and later.
    • decodeCMTimeMapping

      public CMTimeMapping decodeCMTimeMapping​(String key)
      Since:
      Available in iOS 4.0 and later.
    • encodeBytes

      public void encodeBytes​(byte[] bytes)
    • decodeBytes

      public byte[] decodeBytes()
    • encodeObject

      public void encodeObject​(String key, NSObject value)
    • encodeConditionalObject

      public void encodeConditionalObject​(String key, NSObject value)
    • encodeBoolean

      public void encodeBoolean​(String key, boolean value)
    • encodeInteger

      public void encodeInteger​(String key, int value)
    • encodeLong

      public void encodeLong​(String key, long value)
    • encodeFloat

      public void encodeFloat​(String key, float value)
    • encodeDouble

      public void encodeDouble​(String key, double value)
    • encodeBytes

      public void encodeBytes​(String key, byte[] bytes)
    • decodeObject

      public NSObject decodeObject​(String key)
    • decodeBoolean

      public boolean decodeBoolean​(String key)
    • decodeInteger

      public int decodeInteger​(String key)
    • decodeLong

      public long decodeLong​(String key)
    • decodeFloat

      public float decodeFloat​(String key)
    • decodeDouble

      public double decodeDouble​(String key)
    • decodeBytes

      public byte[] decodeBytes​(String key)
    • decodeObject

      public NSObject decodeObject​(String key, Class<? extends NSObject> clazz)
      Since:
      Available in iOS 6.0 and later.
    • decodeObject

      public NSObject decodeObject​(String key, List<ObjCClass> clazzes)
      Since:
      Available in iOS 6.0 and later.
    • encodeString

      public void encodeString​(String key, String value)
    • decodeString

      public String decodeString​(String key)
    • encodeDataObject

      public void encodeDataObject​(NSData data)
    • decodeDataObject

      public NSData decodeDataObject()
    • getVersionForClassName

      public long getVersionForClassName​(String className)
    • encodeObject

      public void encodeObject​(NSObject object)
    • encodeRootObject

      public void encodeRootObject​(NSObject rootObject)
    • encodeBycopyObject

      public void encodeBycopyObject​(NSObject anObject)
    • encodeByrefObject

      public void encodeByrefObject​(NSObject anObject)
    • encodeConditionalObject

      public void encodeConditionalObject​(NSObject object)
    • encodeBytes0

      protected void encodeBytes0​(long byteaddr, long length)
    • decodeObject

      public NSObject decodeObject()
    • decodeTopLevelObject

      public NSObject decodeTopLevelObject() throws NSErrorException
      Throws:
      NSErrorException
      Since:
      Available in iOS 9.0 and later.
    • decodeBytes0

      protected BytePtr decodeBytes0​(MachineSizedUIntPtr lengthp)
    • setObjectZone

      public void setObjectZone​(NSZone zone)
    • getObjectZone

      public NSZone getObjectZone()
    • encodeObject0

      protected void encodeObject0​(NSObject object, String key)
    • encodeConditionalObject0

      protected void encodeConditionalObject0​(NSObject object, String key)
    • encodeBool0

      protected void encodeBool0​(boolean value, String key)
    • encodeInt0

      protected void encodeInt0​(int value, String key)
    • encodeInt320

      protected void encodeInt320​(int value, String key)
    • encodeInt640

      protected void encodeInt640​(long value, String key)
    • encodeFloat0

      protected void encodeFloat0​(float value, String key)
    • encodeDouble0

      protected void encodeDouble0​(double value, String key)
    • encodeBytes0

      protected void encodeBytes0​(long bytes, long length, String key)
    • containsValue

      public boolean containsValue​(String key)
    • decodeObject0

      protected NSObject decodeObject0​(String key)
    • decodeTopLevelObject

      public NSObject decodeTopLevelObject​(String key) throws NSErrorException
      Throws:
      NSErrorException
      Since:
      Available in iOS 9.0 and later.
    • decodeBool0

      protected boolean decodeBool0​(String key)
    • decodeInt0

      protected int decodeInt0​(String key)
    • decodeInt320

      protected int decodeInt320​(String key)
    • decodeInt640

      protected long decodeInt640​(String key)
    • decodeFloat0

      protected float decodeFloat0​(String key)
    • decodeDouble0

      protected double decodeDouble0​(String key)
    • decodeBytes0

      protected BytePtr decodeBytes0​(String key, MachineSizedUIntPtr lengthp)
    • encodeInteger0

      protected void encodeInteger0​(long value, String key)
    • decodeInteger0

      protected long decodeInteger0​(String key)
    • decodeObject0

      protected NSObject decodeObject0​(Class<? extends NSObject> aClass, String key)
    • decodeTopLevelObject

      public NSObject decodeTopLevelObject​(Class<? extends NSObject> aClass, String key) throws NSErrorException
      Throws:
      NSErrorException
      Since:
      Available in iOS 9.0 and later.
    • decodeArray

      protected NSArray<?> decodeArray​(Class<?> cls, String key)
      Since:
      Available in iOS 14.0 and later.
    • decodeDictionary

      protected NSDictionary<?,​?> decodeDictionary​(Class<?> keyCls, Class<?> objectCls, String key)
      Since:
      Available in iOS 14.0 and later.
    • decodeObject0

      protected NSObject decodeObject0​(List<ObjCClass> classes, String key)
    • decodeTopLevelObject

      public NSObject decodeTopLevelObject​(NSSet<?> classes, String key) throws NSErrorException
      Throws:
      NSErrorException
      Since:
      Available in iOS 9.0 and later.
    • decodeArray

      protected NSArray<?> decodeArray​(NSSet<?> classes, String key)
      Since:
      Available in iOS 14.0 and later.
    • decodeDictionary

      protected NSDictionary<?,​?> decodeDictionary​(NSSet<?> keyClasses, NSSet<?> objectClasses, String key)
      Since:
      Available in iOS 14.0 and later.
    • decodePropertyList0

      protected NSObject decodePropertyList0​(String key)
    • fail

      public void fail​(NSError error)
      Since:
      Available in iOS 9.0 and later.