Package org.infinispan.commons.marshall
Class JavaSerializationMarshaller
- java.lang.Object
-
- org.infinispan.commons.marshall.AbstractMarshaller
-
- org.infinispan.commons.marshall.JavaSerializationMarshaller
-
- All Implemented Interfaces:
Marshaller
public class JavaSerializationMarshaller extends AbstractMarshaller
Standard Java serialization marshaller.- Since:
- 5.3
- Author:
- Galder ZamarreƱo
-
-
Field Summary
-
Fields inherited from class org.infinispan.commons.marshall.AbstractMarshaller
marshallableTypeHints
-
-
Constructor Summary
Constructors Constructor Description JavaSerializationMarshaller()
JavaSerializationMarshaller(ClassAllowList allowList)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
initialize(ClassAllowList classAllowList)
An optional method which allows an implementation to respect theClassAllowList
associated with the context, for example the EmbeddedCacheManager or RemoteCacheManager.boolean
isMarshallable(Object o)
A method that checks whether the given object is marshallable as per the rules of this marshaller.org.infinispan.commons.dataconversion.MediaType
mediaType()
Object
objectFromByteBuffer(byte[] buf, int offset, int length)
Unmarshalls an object from a specific portion of a byte array.protected ByteBuffer
objectToBuffer(Object o, int estimatedSize)
This is a convenience method for converting an object into aByteBuffer
which takes an estimated size as parameter.-
Methods inherited from class org.infinispan.commons.marshall.AbstractMarshaller
getBufferSizePredictor, objectFromByteBuffer, objectFromInputStream, objectToBuffer, objectToByteBuffer, objectToByteBuffer
-
Methods inherited from interface org.infinispan.commons.marshall.Marshaller
start, stop
-
-
-
-
Constructor Detail
-
JavaSerializationMarshaller
public JavaSerializationMarshaller()
-
JavaSerializationMarshaller
public JavaSerializationMarshaller(ClassAllowList allowList)
-
-
Method Detail
-
initialize
public void initialize(ClassAllowList classAllowList)
Description copied from interface:Marshaller
An optional method which allows an implementation to respect theClassAllowList
associated with the context, for example the EmbeddedCacheManager or RemoteCacheManager.
-
objectToBuffer
protected ByteBuffer objectToBuffer(Object o, int estimatedSize) throws IOException
Description copied from class:AbstractMarshaller
This is a convenience method for converting an object into aByteBuffer
which takes an estimated size as parameter. AByteBuffer
allows direct access to the byte array with minimal array copying- Specified by:
objectToBuffer
in classAbstractMarshaller
- Parameters:
o
- object to marshallestimatedSize
- an estimate of how large the resulting byte array may be- Throws:
IOException
-
objectFromByteBuffer
public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws IOException, ClassNotFoundException
Description copied from interface:Marshaller
Unmarshalls an object from a specific portion of a byte array.- Parameters:
buf
- byte array containing the binary representation of an object. Must not be null.offset
- point in buffer to start readinglength
- number of bytes to consider- Returns:
- an object
- Throws:
IOException
- if unmarshalling cannot complete due to some I/O errorClassNotFoundException
- if the class of the object trying to unmarshall is unknown
-
isMarshallable
public boolean isMarshallable(Object o)
Description copied from interface:Marshaller
A method that checks whether the given object is marshallable as per the rules of this marshaller.- Parameters:
o
- object to verify whether it's marshallable or not- Returns:
- true if the object is marshallable, otherwise false
-
mediaType
public org.infinispan.commons.dataconversion.MediaType mediaType()
- Returns:
- the
MediaType
associated with the content produced by the marshaller
-
-