Package org.apache.ignite.marshaller
Interface Marshaller
- 
- All Known Implementing Classes:
- AbstractMarshaller,- AbstractNodeNameAwareMarshaller,- JdkMarshaller
 
 public interface MarshallerMarshallerallows to marshal or unmarshal objects in grid. It provides serialization/deserialization mechanism for all instances that are sent across networks or are otherwise serialized.Ignite provides the following Marshallerimplementations:- Default binary marshaller. Will be used when no other marshaller is explicitly set to the
 configuration. For more information, see IgniteBinary.
- JdkMarshaller
 Below are examples of marshaller configuration, usage, and injection into tasks, jobs, and SPI's. Java ExampleMarshallercan be explicitly configured in code.JdkMarshaller marshaller = new JdkMarshaller(); IgniteConfiguration cfg = new IgniteConfiguration(); // Override marshaller. cfg.setMarshaller(marshaller); // Starts grid. G.start(cfg); Spring ExampleMarshaller can be configured from Spring XML configuration file:<bean id="grid.custom.cfg" class="org.apache.ignite.configuration.IgniteConfiguration" singleton="true"> ... <property name="marshaller"> <bean class="org.apache.ignite.marshaller.jdk.JdkMarshaller"/> </property> ... </bean>  
 For information about Spring framework visit www.springframework.org
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]marshal(@Nullable Object obj)Marshals object to byte array.voidmarshal(@Nullable Object obj, OutputStream out)Marshals object to the output stream.voidsetContext(MarshallerContext ctx)Sets marshaller context.<T> Tunmarshal(byte[] arr, @Nullable ClassLoader clsLdr)Unmarshals object from byte array using given class loader.<T> Tunmarshal(InputStream in, @Nullable ClassLoader clsLdr)Unmarshals object from the input stream using given class loader.
 
- 
- 
- 
Method Detail- 
setContextvoid setContext(MarshallerContext ctx) Sets marshaller context.- Parameters:
- ctx- Marshaller context.
 
 - 
marshalvoid marshal(@Nullable @Nullable Object obj, OutputStream out) throws IgniteCheckedExceptionMarshals object to the output stream. This method should not close given output stream.- Parameters:
- obj- Object to marshal.- nullobject will be marshaled to binary- nullrepresentation.
- out- Output stream to marshal into.
- Throws:
- IgniteCheckedException- If marshalling failed.
 
 - 
marshalbyte[] marshal(@Nullable @Nullable Object obj) throws IgniteCheckedExceptionMarshals object to byte array.- Parameters:
- obj- Object to marshal.- nullobject will be marshaled to binary- nullrepresentation.
- Returns:
- Byte array.
- Throws:
- IgniteCheckedException- If marshalling failed.
 
 - 
unmarshal<T> T unmarshal(InputStream in, @Nullable @Nullable ClassLoader clsLdr) throws IgniteCheckedException Unmarshals object from the input stream using given class loader. This method should not close given input stream.- Type Parameters:
- T- Type of unmarshalled object.
- Parameters:
- in- Input stream.
- clsLdr- If not- nullthen given class loader will be used for unmarshal object.
- Returns:
- Unmarshalled object.
- Throws:
- IgniteCheckedException- If unmarshalling failed.
 
 - 
unmarshal<T> T unmarshal(byte[] arr, @Nullable @Nullable ClassLoader clsLdr) throws IgniteCheckedExceptionUnmarshals object from byte array using given class loader.- Type Parameters:
- T- Type of unmarshalled object.
- Parameters:
- arr- Byte array.
- clsLdr- If not- nullthen given class loader will be used for unmarshal object.
- Returns:
- Unmarshalled object.
- Throws:
- IgniteCheckedException- If unmarshalling failed.
 
 
- 
 
-