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
A ProtoStream
Marshaller
implementation that uses Protobuf encoding.- Since:
- 12.0
- Author:
- Ryan Emerson
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.infinispan.protostream.ImmutableSerializationContext
Fields inherited from class org.infinispan.commons.marshall.AbstractMarshaller
marshallableTypeHints
-
Constructor Summary
ConstructorDescriptionImmutableProtoStreamMarshaller
(org.infinispan.protostream.ImmutableSerializationContext serializationContext) -
Method Summary
Modifier and TypeMethodDescriptionorg.infinispan.protostream.ImmutableSerializationContext
boolean
A method that checks whether the given object is marshallable as per the rules of this marshaller.objectFromByteBuffer
(byte[] buf, int offset, int length) Unmarshalls an object from a specific portion of a byte array.objectFromInputStream
(InputStream inputStream) This method implementsStreamingMarshaller.objectFromInputStream(java.io.InputStream)
, but its implementation has been moved here rather that keeping under a class that implements StreamingMarshaller in order to avoid code duplication.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, objectToBuffer, objectToByteBuffer, objectToByteBuffer, objectToOutputStream
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.infinispan.commons.marshall.Marshaller
initialize, start, stop
-
Field Details
-
serializationContext
protected final org.infinispan.protostream.ImmutableSerializationContext serializationContext
-
-
Constructor Details
-
ImmutableProtoStreamMarshaller
public ImmutableProtoStreamMarshaller(org.infinispan.protostream.ImmutableSerializationContext serializationContext)
-
-
Method Details
-
getSerializationContext
public org.infinispan.protostream.ImmutableSerializationContext getSerializationContext() -
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
-
objectFromInputStream
Description copied from class:AbstractMarshaller
This method implementsStreamingMarshaller.objectFromInputStream(java.io.InputStream)
, but its implementation has been moved here rather that keeping under a class that implements StreamingMarshaller in order to avoid code duplication.- Overrides:
objectFromInputStream
in classAbstractMarshaller
- Throws:
IOException
-
isMarshallable
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
-
objectToBuffer
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
-
mediaType
- Returns:
- the
MediaType
associated with the content produced by the marshaller
-