### Build Kryo from Source Source: https://github.com/esotericsoftware/kryo/blob/master/README.md To build all Kryo artifacts from source, ensure you have JDK11+ and Maven installed, then run the following commands. ```bash mvn clean && mvn install ``` -------------------------------- ### Basic Kryo Serialization and Deserialization Source: https://github.com/esotericsoftware/kryo/blob/master/README.md This Java example demonstrates how to use Kryo for basic object serialization to a file and deserialization back into an object. It requires registering the class to be serialized. ```java import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.io.Input; import com.esotericsoftware.kryo.io.Output; import java.io.*; public class HelloKryo { static public void main (String[] args) throws Exception { Kryo kryo = new Kryo(); kryo.register(SomeClass.class); SomeClass object = new SomeClass(); object.value = "Hello Kryo!"; Output output = new Output(new FileOutputStream("file.bin")); kryo.writeObject(output, object); output.close(); Input input = new Input(new FileInputStream("file.bin")); SomeClass object2 = kryo.readObject(input, SomeClass.class); input.close(); } static public class SomeClass { String value; } } ``` -------------------------------- ### Round Trip Serialization Example Source: https://github.com/esotericsoftware/kryo/blob/master/README.md Demonstrates writing an object to a byte buffer and then reading it back. The `Output` buffer grows automatically if needed. The `Input` reads directly from the `Output`'s buffer. ```java Kryo kryo = new Kryo(); // Register all classes to be serialized. cryo.register(SomeClass.class); SomeClass object1 = new SomeClass(); Output output = new Output(1024, -1); cryo.writeObject(output, object1); Input input = new Input(output.getBuffer(), 0, output.position()); SomeClass object2 = kryo.readObject(input, SomeClass.class); ``` -------------------------------- ### Configure Gradle dependencies for Kryo 4 and 5 Source: https://github.com/esotericsoftware/kryo/wiki/Migration-to-v5 Examples for including both Kryo 4 and 5 in a project using Gradle dependencies or local jar files. ```gradle dependencies { api 'com.esotericsoftware:kryo:4.0.2' api 'com.esotericsoftware.kryo:kryo5:5.0.1' } ``` ```gradle dependencies { api "org.objenesis:objenesis:3.1" api "com.esotericsoftware:minlog:1.3.1" api "com.esotericsoftware:reflectasm:1.11.9" api files("libs/kryo-4.0.2.jar") api files("libs/kryo5-5.0.1.jar") } ``` -------------------------------- ### Object Instantiation Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html This section details various methods for instantiating objects using different strategies within the Kryo library. ```APIDOC ## GCJSerializationInstantiator.newInstance ### Description Creates a new instance of an object using GCJ serialization. ### Method `Object` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.gcj.GCJSerializationInstantiator.newInstance()` ## InstantiatorStrategy.newInstantiatorOf ### Description Abstract method to create a new object instantiator for a given class. ### Method `com.esotericsoftware.shaded.org.objenesis.instantiator.ObjectInstantiator` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.strategy.InstantiatorStrategy.newInstantiatorOf(Class p1)` ## JRockit131Instantiator.newInstance ### Description Creates a new instance of an object using JRockit 1.3.1 specific instantiation. ### Method `Object` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.jrockit.JRockit131Instantiator.newInstance()` ## JRockitLegacyInstantiator.newInstance ### Description Creates a new instance of an object using JRockit legacy instantiation. ### Method `Object` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.jrockit.JRockitLegacyInstantiator.newInstance()` ## Kryo.newInstantiator ### Description Creates a new object instantiator for a given class using the Kryo instance. ### Method `com.esotericsoftware.shaded.org.objenesis.instantiator.ObjectInstantiator` ### Endpoint `com.esotericsoftware.kryo.Kryo.newInstantiator(Class type)` ## NewInstanceInstantiator.newInstance ### Description Creates a new instance of an object using the default no-argument constructor. ### Method `Object` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.basic.NewInstanceInstantiator.newInstance()` ## NullInstantiator.newInstance ### Description Creates a null instance. This is typically used when an object cannot be instantiated. ### Method `Object` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.NullInstantiator.newInstance()` ## ObjectInputStreamInstantiator.newInstance ### Description Creates a new instance of an object using ObjectInputStream, which bypasses constructors. ### Method `Object` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.basic.ObjectInputStreamInstantiator.newInstance()` ## ObjectInstantiator.newInstance ### Description Abstract method to create a new instance of an object. ### Method `Object` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.ObjectInstantiator.newInstance()` ``` -------------------------------- ### Serialize Single Generic Type with Kryo Source: https://github.com/esotericsoftware/kryo/blob/master/README.md Example of a custom serializer for a class with a single type parameter. It uses `nextGenericClass` to get the type and `popGenericType` to clean up. This is useful when the type parameter class is final for optimization. ```java public class SomeClass { public T value; } public class SomeClassSerializer extends Serializer { public void write (Kryo kryo, Output output, SomeClass object) { Class valueClass = kryo.getGenerics().nextGenericClass(); if (valueClass != null && kryo.isFinal(valueClass)) { Serializer serializer = kryo.getSerializer(valueClass); kryo.writeObjectOrNull(output, object.value, serializer); } else kryo.writeClassAndObject(output, object.value); kryo.getGenerics().popGenericType(); } public SomeClass read (Kryo kryo, Input input, Class type) { Class valueClass = kryo.getGenerics().nextGenericClass(); SomeClass object = new SomeClass(); kryo.reference(object); if (valueClass != null && kryo.isFinal(valueClass)) { Serializer serializer = kryo.getSerializer(valueClass); object.value = kryo.readObjectOrNull(input, valueClass, serializer); } else object.value = kryo.readClassAndObject(input); kryo.getGenerics().popGenericType(); return object; } } ``` -------------------------------- ### Constructor Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html Details on the constructors for various instantiator classes. ```APIDOC ## JRockit131Instantiator Constructor ### Description Constructs a new JRockit131Instantiator for a given class type. ### Method `JRockit131Instantiator` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.jrockit.JRockit131Instantiator(Class type)` ## JRockitLegacyInstantiator Constructor ### Description Constructs a new JRockitLegacyInstantiator for a given class type. ### Method `JRockitLegacyInstantiator` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.jrockit.JRockitLegacyInstantiator(Class type)` ## NewInstanceInstantiator Constructor ### Description Constructs a new NewInstanceInstantiator for a given class type. ### Method `NewInstanceInstantiator` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.basic.NewInstanceInstantiator(Class type)` ## NullInstantiator Constructor ### Description Constructs a new NullInstantiator. ### Method `NullInstantiator` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.NullInstantiator()` ## ObjectInputStreamInstantiator Constructor ### Description Constructs a new ObjectInputStreamInstantiator for a given class. ### Method `ObjectInputStreamInstantiator` ### Endpoint `com.esotericsoftware.shaded.org.objenesis.instantiator.basic.ObjectInputStreamInstantiator(Class clazz)` ``` -------------------------------- ### Serialize Multiple Generic Types with Kryo Source: https://github.com/esotericsoftware/kryo/blob/master/README.md Example of a custom serializer for a class with multiple type parameters (K, V). It uses `nextGenericTypes` to retrieve an array of `GenericType` instances and `resolve` to get the actual classes. Remember to call `popGenericType` after processing. ```java public class SomeClass { public K key; public V value; } public class SomeClassSerializer extends Serializer { public void write (Kryo kryo, Output output, SomeClass object) { Class keyClass = null, valueClass = null; GenericType[] genericTypes = kryo.getGenerics().nextGenericTypes(); if (genericTypes != null) { keyClass = genericTypes[0].resolve(kryo.getGenerics()); valueClass = genericTypes[1].resolve(kryo.getGenerics()); } if (keyClass != null && kryo.isFinal(keyClass)) { Serializer serializer = kryo.getSerializer(keyClass); kryo.writeObjectOrNull(output, object.key, serializer); } else kryo.writeClassAndObject(output, object.key); if (valueClass != null && kryo.isFinal(valueClass)) { Serializer serializer = kryo.getSerializer(valueClass); kryo.writeObjectOrNull(output, object.value, serializer); } else kryo.writeClassAndObject(output, object.value); kryo.getGenerics().popGenericType(); } public SomeClass read (Kryo kryo, Input input, Class type) { Class keyClass = null, valueClass = null; GenericType[] genericTypes = kryo.getGenerics().nextGenericTypes(); if (genericTypes != null) { keyClass = genericTypes[0].resolve(kryo.getGenerics()); valueClass = genericTypes[1].resolve(kryo.getGenerics()); } SomeClass object = new SomeClass(); kryo.reference(object); if (keyClass != null && kryo.isFinal(keyClass)) { Serializer serializer = kryo.getSerializer(keyClass); object.key = kryo.readObjectOrNull(input, keyClass, serializer); } else object.key = kryo.readClassAndObject(input); if (valueClass != null && kryo.isFinal(valueClass)) { Serializer serializer = kryo.getSerializer(valueClass); object.value = kryo.readObjectOrNull(input, valueClass, serializer); } else object.value = kryo.readClassAndObject(input); kryo.getGenerics().popGenericType(); return object; } } ``` -------------------------------- ### IdentityObjectIntMap get Method (Java) Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.2.1_to_5.3.0/compat_report.html Details the 'get' method for IdentityObjectIntMap in Kryo version 5.3.0, which retrieves an integer value associated with a key, providing a default if the key is not found. ```java IdentityObjectIntMap.get ( K key, int defaultValue )  **:**  int com/esotericsoftware/kryo/util/IdentityObjectIntMap.get:(Ljava/lang/Object;I)I ``` -------------------------------- ### ConstructorAccess API Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.24.0_to_3.0.0/compat_report.html Provides methods for creating new instances of classes using high-performance reflection. ```APIDOC ## ConstructorAccess.get ### Description Retrieves a ConstructorAccess instance for the specified class type. ### Parameters #### Query Parameters - **type** (Class) - Required - The class for which to create a constructor accessor. ### Response - **ConstructorAccess** - An instance of ConstructorAccess for the given type. ``` ```APIDOC ## ConstructorAccess.newInstance ### Description Creates a new instance of the class associated with this ConstructorAccess. ### Parameters #### Request Body - **p1** (Object) - Optional - An optional argument for the constructor. ### Response - **T** - A new instance of the class. ``` -------------------------------- ### IdentityMap get Method Overloads (Java) Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.2.1_to_5.3.0/compat_report.html Shows the overloaded 'get' methods for IdentityMap in Kryo version 5.3.0. These methods handle retrieving values with or without a default value. ```java IdentityMap.get ( K key, V defaultValue )  **:**  V com/esotericsoftware/kryo/util/IdentityMap.get:(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; ``` ```java IdentityMap.get ( T key )  **:**  V com/esotericsoftware/kryo/util/IdentityMap.get:(Ljava/lang/Object;)Ljava/lang/Object; ``` -------------------------------- ### ObjectIntMap.Entry Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.0.0-RC4_to_5.0.0-RC5/compat_report.html Documentation for the ObjectIntMap.Entry class, including its constructor and toString method. ```APIDOC ## ObjectIntMap.Entry Constructor ### Description Constructs a new ObjectIntMap.Entry. ### Method public ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ## ObjectIntMap.Entry.toString ### Description Returns a string representation of the ObjectIntMap.Entry. ### Method public String ### Endpoint N/A ### Parameters None ### Request Example None ### Response - **String**: The string representation of the entry. ``` -------------------------------- ### Util Class Method Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/4.0.2_to_5.0.0-RC1/compat_report.html A utility method for getting class names. ```APIDOC ## Util Class Method ### Description Provides utility functions for common operations. ### Methods - **classNames**(Class[] types): String [static] - Returns an array of class names for the given types. ``` -------------------------------- ### Objenesis Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html The main interface for Objenesis, providing methods to get instantiators and create new instances. ```APIDOC ## Objenesis ### Description Provides core functionality for Objenesis, including obtaining instantiators and creating new object instances. ### Method `getInstantiatorOf(Class p1)` (abstract) ### Endpoint `org/objenesis/Objenesis.getInstantiatorOf ### Parameters - **p1** (Class) - The class for which to get an instantiator. ### Request Example ```json { "p1": "java.lang.String" } ``` ### Response #### Success Response (200) - **ObjectInstantiator** - An instantiator for the specified class. #### Response Example ```json { "example": "instantiator object" } ``` ### Method `newInstance(Class p1)` (abstract) ### Endpoint `org/objenesis/Objenesis.newInstance ### Parameters - **p1** (Class) - The class to instantiate. ### Request Example ```json { "p1": "java.lang.String" } ``` ### Response #### Success Response (200) - **Object** - A new instance of the specified class. #### Response Example ```json { "example": "newly created object" } ``` ``` -------------------------------- ### ByteBufferInput Constructors and Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.23.0_to_2.24.0/compat_report.html Constructors and methods for initializing and configuring ByteBufferInput. ```APIDOC ## ByteBufferInput Constructors and Methods ### Description Constructors and methods for initializing and setting the buffer for ByteBufferInput. ### Constructors - **ByteBufferInput(ByteBuffer buffer, int offset, int count)**: Constructs a ByteBufferInput with a specified buffer, offset, and count. ### Methods - **setBuffer(ByteBuffer bytes, int offset, int count)**: Sets the byte buffer, offset, and count for the input. ``` -------------------------------- ### IdentityObjectIntMap.get() Affected Method Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.0.0-RC4_to_5.0.0-RC5/compat_report.html The 'get' method with a default value in IdentityObjectIntMap is affected. 'ObjectIntMap.get(K, int)' will be called instead. ```java IdentityObjectIntMap.get ( K _key_, int _defaultValue_ ) ``` -------------------------------- ### JRockitLegacyInstantiator Constructor Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html Constructor for legacy JRockit instantiator. ```APIDOC ## JRockitLegacyInstantiator Constructor ### Description Constructs a JRockitLegacyInstantiator for a given class type. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Util API Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.3.0_to_5.4.0/compat_report.html Utility methods for checking system environment properties. ```APIDOC ## Util.isUnsafeAvailable ### Description Checks if the Unsafe class is available in the current environment. ### Response - **boolean** - True if Unsafe is available, false otherwise. ``` -------------------------------- ### Get Next Generic Class Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.0.0-RC6_to_5.0.0-RC7/compat_report.html Retrieves the next generic class from the DefaultGenerics utility. This method was added in Kryo version 5.0.0-RC7. ```java DefaultGenerics.nextGenericClass() ``` -------------------------------- ### IdentityMap Get Method (without default value) Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.2.1_to_5.3.0/compat_report.html Overrides ObjectMap.get(T) to retrieve a value. This method will be called instead of ObjectMap.get(T) in client programs. ```java ObjectMap.get(T _key_) ``` -------------------------------- ### ClassVisitor Constructors and Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.24.0_to_3.0.0/compat_report.html Details on constructors and methods for the ClassVisitor abstract class. ```APIDOC ## ClassVisitor Constructors and Methods ### Description Constructors and methods for the abstract ClassVisitor class. ### Methods - `ClassVisitor(int p1)` - `ClassVisitor(int p1, ClassVisitor p2)` - `visit(int p1, int p2, String p3, String p4, String p5, String[] p6)` - `visitAnnotation(String p1, boolean p2)` - `visitAttribute(Attribute p1)` - `visitEnd()` - `visitField(int p1, String p2, String p3, String p4, Object p5)` - `visitInnerClass(String p1, String p2, String p3, int p4)` - `visitMethod(int p1, String p2, String p3, String p4, String[] p5)` - `visitOuterClass(String p1, String p2, String p3)` - `visitSource(String p1, String p2)` ``` -------------------------------- ### Registration Class Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html Methods for managing object instantiators within Kryo's Registration class. ```APIDOC ## com.esotericsoftware.kryo.Registration ### Methods #### getInstantiator - **Signature**: `ObjectInstantiator getInstantiator()` - **Returns**: The ObjectInstantiator associated with this registration. #### setInstantiator - **Signature**: `void setInstantiator(ObjectInstantiator instantiator)` - **Description**: Sets the ObjectInstantiator for this registration. ``` -------------------------------- ### Get Next Generic Types Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.0.0-RC6_to_5.0.0-RC7/compat_report.html Retrieves the next array of generic types from the DefaultGenerics utility. This method was added in Kryo version 5.0.0-RC7. ```java DefaultGenerics.nextGenericTypes() ``` -------------------------------- ### Get JMH Help Source: https://github.com/esotericsoftware/kryo/blob/master/benchmarks/README.md Display a full list of JMH parameters by running the JMH Main class with the -h flag. This requires the JMH library to be in the classpath. ```bash java -cp "benchmarks/lib/*" org.openjdk.jmh.Main -h ``` -------------------------------- ### StdInstantiatorStrategy Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html The standard instantiator strategy. ```APIDOC ## StdInstantiatorStrategy ### Description The standard instantiator strategy. ### Methods - **newInstantiatorOf(Class type)**: ObjectInstantiator - Creates a new instantiator for the given class using the standard strategy. - **StdInstantiatorStrategy()**: Constructor - Initializes the standard strategy. ### Run-time Name - `com/esotericsoftware/shaded/org/objenesis/strategy/StdInstantiatorStrategy.newInstantiatorOf:(Ljava/lang/Class;)Lcom/esotericsoftware/shaded/org/objenesis/instantiator/ObjectInstantiator;` - `com/esotericsoftware/shaded/org/objenesis/strategy/StdInstantiatorStrategy."":()V` ``` -------------------------------- ### Objenesis Instantiation Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html Provides methods for obtaining object instantiators and creating new instances of classes. ```APIDOC ## Objenesis.getInstantiatorOf ### Description Abstract method to get an object instantiator for a given class. ### Method GET ### Endpoint /objenesis/getInstantiatorOf ### Parameters #### Query Parameters - **p1** (Class) - Required - The class for which to get an instantiator. ### Response #### Success Response (200) - **instantiator** (ObjectInstantiator) - An object instantiator for the specified class. ## Objenesis.newInstance ### Description Abstract method to create a new instance of a given class. ### Method GET ### Endpoint /objenesis/newInstance ### Parameters #### Query Parameters - **p1** (Class) - Required - The class to instantiate. ### Response #### Success Response (200) - **instance** (Object) - A new instance of the specified class. ## ObjenesisBase.getInstantiatorOf ### Description Gets an object instantiator for the given class. ### Method GET ### Endpoint /objenesis/base/getInstantiatorOf ### Parameters #### Query Parameters - **clazz** (Class) - Required - The class for which to get an instantiator. ### Response #### Success Response (200) - **instantiator** (ObjectInstantiator) - An object instantiator for the specified class. ## ObjenesisBase.newInstance ### Description Creates a new instance of the given class. ### Method GET ### Endpoint /objenesis/base/newInstance ### Parameters #### Query Parameters - **clazz** (Class) - Required - The class to instantiate. ### Response #### Success Response (200) - **instance** (Object) - A new instance of the specified class. ## ObjenesisBase.ObjenesisBase (Constructor) ### Description Constructs an ObjenesisBase instance with a specified instantiator strategy. ### Method POST ### Endpoint /objenesis/base ### Parameters #### Request Body - **strategy** (InstantiatorStrategy) - Required - The instantiator strategy to use. ## ObjenesisBase.ObjenesisBase (Constructor with cache) ### Description Constructs an ObjenesisBase instance with a specified instantiator strategy and cache option. ### Method POST ### Endpoint /objenesis/base ### Parameters #### Request Body - **strategy** (InstantiatorStrategy) - Required - The instantiator strategy to use. - **useCache** (boolean) - Optional - Whether to use caching. ## ObjenesisBase.toString ### Description Returns a string representation of the ObjenesisBase instance. ### Method GET ### Endpoint /objenesis/base/toString ### Response #### Success Response (200) - **result** (String) - The string representation. ## ObjenesisHelper.getInstantiatorOf ### Description Gets an object instantiator for the given class (static method). ### Method GET ### Endpoint /objenesis/helper/getInstantiatorOf ### Parameters #### Query Parameters - **clazz** (Class) - Required - The class for which to get an instantiator. ### Response #### Success Response (200) - **instantiator** (ObjectInstantiator) - An object instantiator for the specified class. ## ObjenesisHelper.getSerializableObjectInstantiatorOf ### Description Gets a serializable object instantiator for the given class (static method). ### Method GET ### Endpoint /objenesis/helper/getSerializableObjectInstantiatorOf ### Parameters #### Query Parameters - **clazz** (Class) - Required - The class for which to get a serializable instantiator. ### Response #### Success Response (200) - **instantiator** (ObjectInstantiator) - A serializable object instantiator for the specified class. ## ObjenesisHelper.newInstance ### Description Creates a new instance of the given class (static method). ### Method GET ### Endpoint /objenesis/helper/newInstance ### Parameters #### Query Parameters - **clazz** (Class) - Required - The class to instantiate. ### Response #### Success Response (200) - **instance** (Object) - A new instance of the specified class. ## ObjenesisHelper.newSerializableInstance ### Description Creates a new serializable instance of the given class (static method). ### Method GET ### Endpoint /objenesis/helper/newSerializableInstance ### Parameters #### Query Parameters - **clazz** (Class) - Required - The class to instantiate. ### Response #### Success Response (200) - **instance** (Serializable) - A new serializable instance of the specified class. ## ObjenesisSerializer.ObjenesisSerializer (Constructor) ### Description Constructs an ObjenesisSerializer instance. ### Method POST ### Endpoint /objenesis/serializer ## ObjenesisSerializer.ObjenesisSerializer (Constructor with cache) ### Description Constructs an ObjenesisSerializer instance with a cache option. ### Method POST ### Endpoint /objenesis/serializer ### Parameters #### Request Body - **useCache** (boolean) - Optional - Whether to use caching. ## ObjenesisStd.ObjenesisStd (Constructor) ### Description Constructs an ObjenesisStd instance. ### Method POST ### Endpoint /objenesis/std ## ObjenesisStd.ObjenesisStd (Constructor with cache) ### Description Constructs an ObjenesisStd instance with a cache option. ### Method POST ### Endpoint /objenesis/std ### Parameters #### Request Body - **useCache** (boolean) - Optional - Whether to use caching. ## ObjectStreamClassInstantiator.ObjectStreamClassInstantiator (Constructor) ### Description Constructs an ObjectStreamClassInstantiator instance. ### Method POST ### Endpoint /objenesis/instantiator/objectstreamclass ### Parameters #### Request Body - **type** (Class) - Required - The class type for which to create an instantiator. ## Output.total ### Description Returns the total number of bytes written to the output. ### Method GET ### Endpoint /kryo/io/output/total ### Response #### Success Response (200) - **total** (int) - The total number of bytes written. ``` -------------------------------- ### IdentityObjectIntMap Get Method Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.2.1_to_5.3.0/compat_report.html Overrides ObjectIntMap.get(K, int) to provide a default integer value. This method will be called instead of ObjectIntMap.get(K, int) in client programs. ```java ObjectIntMap.get(K _key_, int _defaultValue_) ``` -------------------------------- ### IdentityMap Get Method (with default value) Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.2.1_to_5.3.0/compat_report.html Overrides ObjectMap.get(K, V) to provide a default value. This method will be called instead of ObjectMap.get(K, V) in client programs. ```java ObjectMap.get(K _key_, V _defaultValue_) ``` -------------------------------- ### Kryo Instantiator and IO Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.24.0_to_3.0.0/compat_report.html Utility methods for instantiator strategies and input stream management. ```Java Kryo.DefaultInstantiatorStrategy.Kryo.DefaultInstantiatorStrategy ( org.objenesis.strategy.InstantiatorStrategy fallbackStrategy ) ``` ```Java Input.setTotal ( long total ) : void ``` -------------------------------- ### MethodVisitor Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.24.0_to_3.0.0/compat_report.html This section lists the available methods for the MethodVisitor class, including their parameters and return types. ```APIDOC ## MethodVisitor Methods ### visitAnnotationDefault #### Description Visits the default value of an annotation element. ### Method `visitAnnotationDefault` ### Parameters None ### Response Returns an `AnnotationVisitor` object. --- ### visitAttribute #### Description Visits a non-standard attribute of this method. ### Method `visitAttribute` ### Parameters - **p1** (Attribute) - The attribute to visit. ### Response None --- ### visitCode #### Description Visits the code of the method. ### Method `visitCode` ### Parameters None ### Response None --- ### visitEnd #### Description Visits the end of the method. ### Method `visitEnd` ### Parameters None ### Response None --- ### visitFieldInsn #### Description Visits a field instruction. ### Method `visitFieldInsn` ### Parameters - **p1** (int) - The opcode of the field instruction. - **p2** (String) - The internal name of the field. - **p3** (String) - The field descriptor. - **p4** (String) - The name of the field. ### Response None --- ### visitFrame #### Description Visits the frame of a basic block. ### Method `visitFrame` ### Parameters - **p1** (int) - The type of frame. - **p2** (int) - The number of variables in the frame. - **p3** (Object[]) - The values of the variables in the frame. - **p4** (int) - The number of stack elements in the frame. - **p5** (Object[]) - The values of the stack elements in the frame. ### Response None --- ### visitIincInsn #### Description Visits an increment instruction. ### Method `visitIincInsn` ### Parameters - **p1** (int) - The index of the local variable to be incremented. - **p2** (int) - The amount to increment by. ### Response None --- ### visitInsn #### Description Visits a zero operand instruction. ### Method `visitInsn` ### Parameters - **p1** (int) - The opcode of the instruction. ### Response None --- ### visitIntInsn #### Description Visits a one operand instruction. ### Method `visitIntInsn` ### Parameters - **p1** (int) - The opcode of the instruction. - **p2** (int) - The operand of the instruction. ### Response None --- ### visitInvokeDynamicInsn #### Description Visits an invokedynamic instruction. ### Method `visitInvokeDynamicInsn` ### Parameters - **p1** (String) - The name of the method. - **p2** (String) - The descriptor of the method. - **p3** (Handle) - The handle of the invokedynamic instruction. - **p4** (Object...) - The dynamic constant arguments of the invokedynamic instruction. ### Response None --- ### visitJumpInsn #### Description Visits a jump instruction. ### Method `visitJumpInsn` ### Parameters - **p1** (int) - The opcode of the instruction. - **p2** (Label) - The label to which the instruction jumps. ### Response None --- ### visitLabel #### Description Marks a label that can be used for a jump instruction. ### Method `visitLabel` ### Parameters - **p1** (Label) - The label to be marked. ### Response None --- ### visitLdcInsn #### Description Visits a load constant instruction. ### Method `visitLdcInsn` ### Parameters - **p1** (Object) - The constant to be loaded. ### Response None --- ### visitLineNumber #### Description Visits a line number annotation. ### Method `visitLineNumber` ### Parameters - **p1** (int) - The line number. - **p2** (Label) - The label corresponding to the line number. ### Response None --- ### visitLocalVariable #### Description Visits a local variable annotation. ### Method `visitLocalVariable` ### Parameters - **p1** (String) - The name of the local variable. - **p2** (String) - The descriptor of the local variable. - **p3** (String) - The signature of the local variable. - **p4** (Label) - The start label of the local variable. - **p5** (Label) - The end label of the local variable. - **p6** (int) - The index of the local variable. ### Response None --- ### visitLookupSwitchInsn #### Description Visits a lookup switch instruction. ### Method `visitLookupSwitchInsn` ### Parameters - **p1** (Label) - The default label. - **p2** (int[]) - The array of keys. - **p3** (Label[]) - The array of labels. ### Response None --- ### visitMaxs #### Description Visits the maximum stack size and number of local variables of the method. ### Method `visitMaxs` ### Parameters - **p1** (int) - The maximum stack size. - **p2** (int) - The number of local variables. ### Response None --- ### visitMethodInsn #### Description Visits a method instruction. ### Method `visitMethodInsn` ### Parameters - **p1** (int) - The opcode of the method instruction. - **p2** (String) - The internal name of the method's owner. - **p3** (String) - The name of the method. - **p4** (String) - The descriptor of the method. ### Response None --- ### visitMultiANewArrayInsn #### Description Visits a multi-dimensional array creation instruction. ### Method `visitMultiANewArrayInsn` ### Parameters - **p1** (String) - The descriptor of the array type. - **p2** (int) - The number of dimensions of the array. ### Response None --- ### visitParameterAnnotation #### Description Visits an annotation of a parameter. ### Method `visitParameterAnnotation` ### Parameters - **p1** (int) - The parameter index. - **p2** (String) - The descriptor of the annotation type. - **p3** (boolean) - Whether the annotation is visible at runtime. ### Response Returns an `AnnotationVisitor` object. --- ### visitTableSwitchInsn #### Description Visits a table switch instruction. ### Method `visitTableSwitchInsn` ### Parameters - **p1** (int) - The minimum value. - **p2** (int) - The maximum value. - **p3** (Label) - The default label. - **p4** (Label...) - The array of labels. ### Response None ``` -------------------------------- ### FastOutput Constructors and Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/4.0.2_to_5.0.0-RC1/compat_report.html Constructors for initializing FastOutput and methods for writing data. ```APIDOC ## FastOutput Constructors ### Description Constructors for creating instances of FastOutput with different configurations. ### Method POST ### Endpoint /esotericsoftware/kryo/io/FastOutput ### Parameters #### Request Body - **buffer** (byte[]) - Optional - The buffer to use for output. - **maxBufferSize** (int) - Optional - The maximum buffer size. - **bufferSize** (int) - Optional - The initial buffer size. - **outputStream** (OutputStream) - Optional - The output stream to write to. ### Response #### Success Response (200) - **instance** (FastOutput) - The newly created FastOutput instance. ## FastOutput.writeInt ### Description Writes an integer value to the output, with an option for positive optimization. ### Method POST ### Endpoint /esotericsoftware/kryo/io/FastOutput ### Parameters #### Request Body - **value** (int) - Required - The integer value to write. - **optimizePositive** (boolean) - Optional - If true, uses a more efficient encoding for positive integers. ### Response #### Success Response (200) - **bytesWritten** (int) - The number of bytes written. ## FastOutput.writeLong ### Description Writes a long value to the output, with an option for positive optimization. ### Method POST ### Endpoint /esotericsoftware/kryo/io/FastOutput ### Parameters #### Request Body - **value** (long) - Required - The long value to write. - **optimizePositive** (boolean) - Optional - If true, uses a more efficient encoding for positive long values. ### Response #### Success Response (200) - **bytesWritten** (int) - The number of bytes written. ``` -------------------------------- ### Configure FieldSerializer Settings Source: https://github.com/esotericsoftware/kryo/blob/master/README.md Modify FieldSerializer settings to control how fields are serialized. This example demonstrates removing a field and configuring specific field properties like nullability and class type. ```java FieldSerializer fieldSerializer = ... fieldSerializer.removeField("id"); // Won't be serialized. CachedField nameField = fieldSerializer.getField("name"); nameField.setCanBeNull(false); CachedField someClassField = fieldSerializer.getField("someClass"); someClassField.setClass(SomeClass.class, new SomeClassSerializer()); ``` -------------------------------- ### FastOutput Constructors and Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/4.0.2_to_5.0.0-RC1/compat_report.html Constructors for initializing FastOutput and methods for writing data. ```APIDOC ## FastOutput Constructors ### Description Constructors for creating instances of FastOutput with different configurations. ### Method POST ### Endpoint /esotericsoftware/kryo/io/FastOutput ### Parameters #### Request Body - **buffer** (byte[]) - Optional - The byte array to use as the buffer. - **maxBufferSize** (int) - Optional - The maximum size of the buffer. - **bufferSize** (int) - Optional - The initial size of the buffer. - **outputStream** (OutputStream) - Optional - The output stream to write to. ### Response #### Success Response (200) - **instance** (FastOutput) - The newly created FastOutput instance. ## FastOutput.writeInt ### Description Writes an integer value to the output, with an option for positive optimization. ### Method POST ### Endpoint /esotericsoftware/kryo/io/FastOutput ### Parameters #### Request Body - **value** (int) - Required - The integer value to write. - **optimizePositive** (boolean) - Optional - If true, uses a more efficient encoding for positive integers. ### Response #### Success Response (200) - **bytesWritten** (int) - The number of bytes written. ## FastOutput.writeLong ### Description Writes a long value to the output, with an option for positive optimization. ### Method POST ### Endpoint /esotericsoftware/kryo/io/FastOutput ### Parameters #### Request Body - **value** (long) - Required - The long value to write. - **optimizePositive** (boolean) - Optional - If true, uses a more efficient encoding for positive long values. ### Response #### Success Response (200) - **bytesWritten** (int) - The number of bytes written. ``` -------------------------------- ### Implement a Custom Serializer for Color Source: https://github.com/esotericsoftware/kryo/blob/master/README.md Provides an example of a custom Serializer for the Color class. The `write` method serializes the Color's RGB integer value, and the `read` method reconstructs a Color object from this integer. ```java public class ColorSerializer extends Serializer { public void write (Kryo kryo, Output output, Color color) { output.writeInt(color.getRGB()); } public Color read (Kryo kryo, Input input, Class type) { return new Color(input.readInt()); } } ``` -------------------------------- ### ClassVisitor Methods and Constructors Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.24.0_to_3.0.0/compat_report.html This section details the constructors and methods of the abstract ClassVisitor class. ```APIDOC ## ClassVisitor Methods and Constructors ### Description Constructors and methods for the abstract ClassVisitor class. ### Methods and Constructors #### Constructors - **ClassVisitor** (int p1) - **ClassVisitor** (int p1, ClassVisitor p2) #### Methods - **visit** (int p1, int p2, String p3, String p4, String p5, String[] p6) - **visitAnnotation** (String p1, boolean p2) - **visitAttribute** (Attribute p1) - **visitEnd** () - **visitField** (int p1, String p2, String p3, String p4, Object p5) - **visitInnerClass** (String p1, String p2, String p3, int p4) - **visitMethod** (int p1, String p2, String p3, String p4, String[] p5) - **visitOuterClass** (String p1, String p2, String p3) - **visitSource** (String p1, String p2) ``` -------------------------------- ### Register Classes for Closure Serialization Source: https://github.com/esotericsoftware/kryo/blob/master/README.md Before serializing closures, ensure that necessary classes like Object[], Class, ClosureSerializer.Closure, and the closure's capturing class are registered with Kryo. This setup is crucial for Kryo to correctly locate and deserialize closure objects. ```java kryo.register(Object[].class); kryo.register(Class.class); kryo.register(ClosureSerializer.Closure.class, new ClosureSerializer()); kryo.register(CapturingClass.class); ``` -------------------------------- ### ObjenesisStd Class Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html The standard Objenesis instantiator strategy. ```APIDOC ## ObjenesisStd.ObjenesisStd (Constructor) ### Description Constructs a new ObjenesisStd instance. ### Method Constructor ### Endpoint N/A (Java Constructor) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ## ObjenesisStd.ObjenesisStd (Constructor with cache) ### Description Constructs a new ObjenesisStd instance with cache enabled or disabled. ### Method Constructor ### Endpoint N/A (Java Constructor) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Kryo Configuration Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html Methods for configuring the behavior of the Kryo instance, including reference copying, instantiator strategies, and stream factories. ```APIDOC ## Kryo Configuration ### Description Configures the Kryo instance settings. ### Methods - **setCopyReferences(boolean copyReferences)**: Sets whether to copy references. - **setInstantiatorStrategy(InstantiatorStrategy strategy)**: Sets the strategy for instantiating objects. - **setStreamFactory(StreamFactory streamFactory)**: Sets the factory for streams. ``` -------------------------------- ### ObjenesisHelper Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html Provides utility methods for creating object instantiators. ```APIDOC ## ObjenesisHelper.getSerializableObjectInstantiatorOf ### Description Gets a serializable object instantiator for a given class. ### Method static ### Endpoint N/A (Java Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **ObjectInstantiator** (org.objenesis.instantiator.ObjectInstantiator) - An instantiator for serializable objects. #### Response Example N/A ## ObjenesisHelper.newInstance ### Description Creates a new instance of the given class. ### Method static ### Endpoint N/A (Java Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **Object** - A new instance of the provided class. #### Response Example N/A ## ObjenesisHelper.newSerializableInstance ### Description Creates a new serializable instance of the given class. ### Method static ### Endpoint N/A (Java Method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **Serializable** (java.io.Serializable) - A new serializable instance of the provided class. #### Response Example N/A ``` -------------------------------- ### IntMap Methods Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/5.0.0-RC4_to_5.0.0-RC5/compat_report.html Provides documentation for various methods of the IntMap class, including equality checks, hash code generation, emptiness checks, and iteration. ```APIDOC ## IntMap.equals ### Description Checks if this IntMap is equal to another object. ### Method GET ### Endpoint /esotericsoftware/kryo/util/IntMap.equals ### Parameters #### Path Parameters - **obj** (Object) - Required - The object to compare with. ### Response #### Success Response (200) - **boolean** (boolean) - True if the maps are equal, false otherwise. ## IntMap.equalsIdentity ### Description Checks if this IntMap is identical to another object. ### Method GET ### Endpoint /esotericsoftware/kryo/util/IntMap.equalsIdentity ### Parameters #### Path Parameters - **obj** (Object) - Required - The object to compare with. ### Response #### Success Response (200) - **boolean** (boolean) - True if the maps are identical, false otherwise. ## IntMap.hashCode ### Description Returns the hash code for this IntMap. ### Method GET ### Endpoint /esotericsoftware/kryo/util/IntMap.hashCode ### Response #### Success Response (200) - **int** (int) - The hash code value. ## IntMap.isEmpty ### Description Checks if the IntMap is empty. ### Method GET ### Endpoint /esotericsoftware/kryo/util/IntMap.isEmpty ### Response #### Success Response (200) - **boolean** (boolean) - True if the map is empty, false otherwise. ## IntMap.iterator ### Description Returns an iterator over the entries in this IntMap. ### Method GET ### Endpoint /esotericsoftware/kryo/util/IntMap.iterator ### Response #### Success Response (200) - **Iterator>** (Iterator) - An iterator for the map entries. ## IntMap.notEmpty ### Description Checks if the IntMap is not empty. ### Method GET ### Endpoint /esotericsoftware/kryo/util/IntMap.notEmpty ### Response #### Success Response (200) - **boolean** (boolean) - True if the map is not empty, false otherwise. ## IntMap.place ### Description Places an item in the map and returns its index. ### Method POST ### Endpoint /esotericsoftware/kryo/util/IntMap.place ### Parameters #### Query Parameters - **item** (int) - Required - The item to place. ### Response #### Success Response (200) - **int** (int) - The index where the item was placed. ``` -------------------------------- ### ObjenesisHelper API Source: https://github.com/esotericsoftware/kryo/blob/master/compat_reports/kryo/2.22_to_2.23.0/compat_report.html Utility methods for creating object instances and instantiators. ```APIDOC ## ObjenesisHelper Methods ### Description Provides static helper methods to retrieve instantiators or create new instances of classes. ### Methods - **getSerializableObjectInstantiatorOf(Class clazz)**: Returns an ObjectInstantiator for a serializable class. - **newInstance(Class clazz)**: Creates a new instance of the specified class. - **newSerializableInstance(Class clazz)**: Creates a new serializable instance of the specified class. ```