public class SnapshotWriter extends Object implements io.atomix.storage.buffer.BufferOutput<SnapshotWriter>
Snapshot.
This class provides the primary interface for writing snapshot buffers to disk or memory.
Snapshot bytes are written to an underlying Buffer which is backed by either memory
or disk based on the configured StorageLevel.
In addition to standard BufferOutput methods, snapshot readers support writing serializable objects
to the snapshot via the writeObject(Object, Function) method. Serializable types must be registered on the
RaftServer serializer to be supported in snapshots.
public Snapshot snapshot()
public <T> SnapshotWriter writeObject(T object, com.google.common.base.Function<T,byte[]> encoder)
object - the object to writeencoder - the object encoderpublic SnapshotWriter write(io.atomix.storage.buffer.Bytes bytes)
write in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter write(byte[] bytes)
write in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter write(io.atomix.storage.buffer.Bytes bytes, int offset, int length)
write in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter write(byte[] bytes, int offset, int length)
write in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter write(io.atomix.storage.buffer.Buffer buffer)
write in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeByte(int b)
writeByte in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeUnsignedByte(int b)
writeUnsignedByte in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeChar(char c)
writeChar in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeShort(short s)
writeShort in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeUnsignedShort(int s)
writeUnsignedShort in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeMedium(int m)
writeMedium in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeUnsignedMedium(int m)
writeUnsignedMedium in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeInt(int i)
writeInt in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeUnsignedInt(long i)
writeUnsignedInt in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeLong(long l)
writeLong in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeFloat(float f)
writeFloat in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeDouble(double d)
writeDouble in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeBoolean(boolean b)
writeBoolean in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeString(String s)
writeString in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeString(String s, Charset charset)
writeString in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter writeUTF8(String s)
writeUTF8 in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public SnapshotWriter flush()
flush in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>public void close()
close in interface io.atomix.storage.buffer.BufferOutput<SnapshotWriter>close in interface AutoCloseableCopyright © 2013–2017. All rights reserved.