public class SnapshotReader extends Object implements io.atomix.storage.buffer.BufferInput<SnapshotReader>
Snapshot.
This class provides the primary interface for reading snapshot buffers from disk or memory.
Snapshot bytes are read from an underlying Buffer which is backed by either memory
or disk based on the configured StorageLevel.
In addition to standard BufferInput methods, snapshot readers support reading serializable objects
from the snapshot via the readObject(Function) method. Serializable types must be registered on the
RaftServer serializer to be supported in snapshots.
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
hasRemaining() |
int |
position() |
SnapshotReader |
read(io.atomix.storage.buffer.Buffer buffer) |
SnapshotReader |
read(byte[] bytes) |
SnapshotReader |
read(byte[] bytes,
int offset,
int length) |
SnapshotReader |
read(io.atomix.storage.buffer.Bytes bytes) |
SnapshotReader |
read(io.atomix.storage.buffer.Bytes bytes,
int offset,
int length) |
boolean |
readBoolean() |
int |
readByte() |
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
int |
readInt() |
long |
readLong() |
int |
readMedium() |
<T> T |
readObject(com.google.common.base.Function<byte[],T> decoder)
Reads an object from the buffer.
|
short |
readShort() |
String |
readString() |
String |
readString(Charset charset) |
int |
readUnsignedByte() |
long |
readUnsignedInt() |
int |
readUnsignedMedium() |
int |
readUnsignedShort() |
String |
readUTF8() |
int |
remaining() |
SnapshotReader |
skip(int bytes) |
Snapshot |
snapshot()
Returns the snapshot associated with the reader.
|
public Snapshot snapshot()
public int position()
position in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public int remaining()
remaining in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public boolean hasRemaining()
hasRemaining in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public SnapshotReader skip(int bytes)
skip in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public <T> T readObject(com.google.common.base.Function<byte[],T> decoder)
T - the type of the object to readdecoder - the object decoderpublic SnapshotReader read(io.atomix.storage.buffer.Bytes bytes)
read in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public SnapshotReader read(byte[] bytes)
read in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public SnapshotReader read(io.atomix.storage.buffer.Bytes bytes, int offset, int length)
read in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public SnapshotReader read(byte[] bytes, int offset, int length)
read in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public SnapshotReader read(io.atomix.storage.buffer.Buffer buffer)
read in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public int readByte()
readByte in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public int readUnsignedByte()
readUnsignedByte in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public char readChar()
readChar in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public short readShort()
readShort in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public int readUnsignedShort()
readUnsignedShort in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public int readMedium()
readMedium in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public int readUnsignedMedium()
readUnsignedMedium in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public int readInt()
readInt in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public long readUnsignedInt()
readUnsignedInt in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public long readLong()
readLong in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public float readFloat()
readFloat in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public double readDouble()
readDouble in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public boolean readBoolean()
readBoolean in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public String readString()
readString in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public String readString(Charset charset)
readString in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public String readUTF8()
readUTF8 in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>public void close()
close in interface io.atomix.storage.buffer.BufferInput<SnapshotReader>close in interface AutoCloseableCopyright © 2013–2017. All rights reserved.