Class BaseProtoStreamMarshaller
- java.lang.Object
-
- org.infinispan.commons.marshall.AbstractMarshaller
-
- org.infinispan.query.remote.client.BaseProtoStreamMarshaller
-
- All Implemented Interfaces:
org.infinispan.commons.marshall.Marshaller
- Direct Known Subclasses:
CompatibilityProtoStreamMarshaller,ProtoStreamMarshaller
public abstract class BaseProtoStreamMarshaller extends org.infinispan.commons.marshall.AbstractMarshallerProvides the starting point for implementing aMarshallerthat uses Protobuf encoding. Subclasses must implement just a singlegetSerializationContext()lookup method.- Since:
- 6.0
- Author:
- anistor@redhat.com
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseProtoStreamMarshaller()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract org.infinispan.protostream.SerializationContextgetSerializationContext()Subclasses must implement this method in order to provide a way to lookup theSerializationContextbooleanisMarshallable(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 org.infinispan.commons.io.ByteBufferobjectToBuffer(Object o, int estimatedSize)This is a convenience method for converting an object into aByteBufferwhich takes an estimated size as parameter.
-
-
-
Method Detail
-
getSerializationContext
protected abstract org.infinispan.protostream.SerializationContext getSerializationContext()
Subclasses must implement this method in order to provide a way to lookup theSerializationContext- Returns:
- the SerializationContext instance to use
-
objectFromByteBuffer
public Object objectFromByteBuffer(byte[] buf, int offset, int length) throws IOException, ClassNotFoundException
Description copied from interface:org.infinispan.commons.marshall.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:org.infinispan.commons.marshall.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 org.infinispan.commons.io.ByteBuffer objectToBuffer(Object o, int estimatedSize) throws IOException, InterruptedException
Description copied from class:org.infinispan.commons.marshall.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 classorg.infinispan.commons.marshall.AbstractMarshaller- Parameters:
o- object to marshallestimatedSize- an estimate of how large the resulting byte array may be- Throws:
IOExceptionInterruptedException
-
mediaType
public org.infinispan.commons.dataconversion.MediaType mediaType()
- Returns:
- the
MediaTypeassociated with the content produced by the marshaller
-
-