Package org.infinispan.commons.marshall
Class ImmutableProtoStreamMarshaller
- java.lang.Object
-
- org.infinispan.commons.marshall.AbstractMarshaller
-
- org.infinispan.commons.marshall.ImmutableProtoStreamMarshaller
-
- All Implemented Interfaces:
Marshaller
- Direct Known Subclasses:
ProtoStreamMarshaller
public class ImmutableProtoStreamMarshaller extends AbstractMarshaller
A ProtoStreamMarshallerimplementation that uses Protobuf encoding.- Since:
- 12.0
- Author:
- Ryan Emerson
-
-
Field Summary
Fields Modifier and Type Field Description protected org.infinispan.protostream.ImmutableSerializationContextserializationContext-
Fields inherited from class org.infinispan.commons.marshall.AbstractMarshaller
marshallableTypeHints
-
-
Constructor Summary
Constructors Constructor Description ImmutableProtoStreamMarshaller(org.infinispan.protostream.ImmutableSerializationContext serializationContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.infinispan.protostream.ImmutableSerializationContextgetSerializationContext()booleanisMarshallable(Object o)A method that checks whether the given object is marshallable as per the rules of this marshaller.org.infinispan.commons.dataconversion.MediaTypemediaType()ObjectobjectFromByteBuffer(byte[] buf, int offset, int length)Unmarshalls an object from a specific portion of a byte array.protected ByteBufferobjectToBuffer(Object o, int estimatedSize)This is a convenience method for converting an object into aByteBufferwhich 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
initialize, start, stop
-
-
-
-
Method Detail
-
getSerializationContext
public org.infinispan.protostream.ImmutableSerializationContext getSerializationContext()
-
objectFromByteBuffer
public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws IOException, ClassNotFoundException
Description copied from interface:MarshallerUnmarshalls 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:MarshallerA 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
-
objectToBuffer
protected ByteBuffer objectToBuffer(Object o, int estimatedSize) throws IOException
Description copied from class:AbstractMarshallerThis is a convenience method for converting an object into aByteBufferwhich takes an estimated size as parameter. AByteBufferallows direct access to the byte array with minimal array copying- Specified by:
objectToBufferin classAbstractMarshaller- Parameters:
o- object to marshallestimatedSize- an estimate of how large the resulting byte array may be- Throws:
IOException
-
mediaType
public org.infinispan.commons.dataconversion.MediaType mediaType()
- Returns:
- the
MediaTypeassociated with the content produced by the marshaller
-
-