Package com.rvandoosselaer.blocks
Class FileRepository
- java.lang.Object
-
- com.rvandoosselaer.blocks.FileRepository
-
- All Implemented Interfaces:
ChunkRepository
public class FileRepository extends java.lang.Object implements ChunkRepository
A File repository implementation for loading and storing chunks using the Protocol Buffers method. Each chunk is stored in a separate file.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXTENSION
-
Constructor Summary
Constructors Constructor Description FileRepository()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getChunkFilename(@NonNull Chunk chunk)
java.nio.file.Path
getChunkPath(@NonNull Chunk chunk)
Chunk
load(com.simsilica.mathd.Vec3i location)
Loads the chunk for the given chunk location.boolean
save(Chunk chunk)
Saves the chunk
-
-
-
Field Detail
-
EXTENSION
public static final java.lang.String EXTENSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
load
public Chunk load(com.simsilica.mathd.Vec3i location)
Description copied from interface:ChunkRepository
Loads the chunk for the given chunk location.- Specified by:
load
in interfaceChunkRepository
- Parameters:
location
- of the chunk- Returns:
- chunk or null if the chunk could not be loaded
-
save
public boolean save(Chunk chunk)
Description copied from interface:ChunkRepository
Saves the chunk- Specified by:
save
in interfaceChunkRepository
- Parameters:
chunk
- to save- Returns:
- true when successfully saved, false otherwise
-
getChunkPath
public java.nio.file.Path getChunkPath(@NonNull @NonNull Chunk chunk)
-
getChunkFilename
public static java.lang.String getChunkFilename(@NonNull @NonNull Chunk chunk)
-
-