Class UnsafeBufferWriter<S>
java.lang.Object
com.jozufozu.flywheel.backend.struct.BufferWriter<S>
com.jozufozu.flywheel.backend.struct.UnsafeBufferWriter<S>
- All Implemented Interfaces:
StructWriter<S>
- Direct Known Subclasses:
BasicWriterUnsafe
This class copied/adapted from jellysquid's
An unsafe
BufferWriter implementation which uses direct memory operations to enable fast blitting of
data into memory buffers. Only available on JVMs which support Unsafe, but generally produces much
better optimized code than other implementations. The implementation does not check for invalid memory accesses,
meaning that errors can corrupt process memory.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longThe write pointer into the buffer storage.Fields inherited from class com.jozufozu.flywheel.backend.struct.BufferWriter
backingBuffer, stride -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedUnsafeBufferWriter(VecBuffer backingBuffer, StructType<S> vertexType) -
Method Summary
Methods inherited from class com.jozufozu.flywheel.backend.struct.BufferWriter
write, writeInternal
-
Field Details
-
writePointer
protected long writePointerThe write pointer into the buffer storage. This is advanced by the stride every timeadvance()is called.
-
-
Constructor Details
-
UnsafeBufferWriter
-
-
Method Details
-
seek
public void seek(int pos) Description copied from interface:StructWriterSeek to the given position. The next write will occur there.- Specified by:
seekin interfaceStructWriter<S>- Overrides:
seekin classBufferWriter<S>
-
advance
protected void advance()Description copied from class:BufferWriterAdvances the write pointer forward by the stride of one vertex. This will always be called after a struct is written, implementors need not call it themselves.- Specified by:
advancein classBufferWriter<S>- See Also:
-