Record Class RaftEntrySerializer.SerializedBufferWriterAdapter
java.lang.Object
java.lang.Record
io.atomix.raft.storage.serializer.RaftEntrySerializer.SerializedBufferWriterAdapter
- All Implemented Interfaces:
BufferWriter
- Enclosing interface:
RaftEntrySerializer
public static record RaftEntrySerializer.SerializedBufferWriterAdapter(Supplier<Integer> getRecordLengthFunction, BiFunction<org.agrona.MutableDirectBuffer,Integer,Integer> writeFunction)
extends Record
implements BufferWriter
A buffer writer based on serializer logic provided as functions.
-
Constructor Summary
ConstructorsConstructorDescriptionSerializedBufferWriterAdapter(Supplier<Integer> getRecordLengthFunction, BiFunction<org.agrona.MutableDirectBuffer, Integer, Integer> writeFunction) Creates an instance of aSerializedBufferWriterAdapterrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intReturns the value of thegetRecordLengthFunctionrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.voidwrite(org.agrona.MutableDirectBuffer writeBuffer, int offset) BiFunction<org.agrona.MutableDirectBuffer, Integer, Integer> Returns the value of thewriteFunctionrecord component.
-
Constructor Details
-
SerializedBufferWriterAdapter
public SerializedBufferWriterAdapter(Supplier<Integer> getRecordLengthFunction, BiFunction<org.agrona.MutableDirectBuffer, Integer, Integer> writeFunction) Creates an instance of aSerializedBufferWriterAdapterrecord class.- Parameters:
getRecordLengthFunction- the value for thegetRecordLengthFunctionrecord componentwriteFunction- the value for thewriteFunctionrecord component
-
-
Method Details
-
getLength
public int getLength()- Specified by:
getLengthin interfaceBufferWriter
-
write
public void write(org.agrona.MutableDirectBuffer writeBuffer, int offset) - Specified by:
writein interfaceBufferWriter
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
getRecordLengthFunction
Returns the value of thegetRecordLengthFunctionrecord component.- Returns:
- the value of the
getRecordLengthFunctionrecord component
-
writeFunction
Returns the value of thewriteFunctionrecord component.- Returns:
- the value of the
writeFunctionrecord component
-