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.StringEXTENSION
-
Constructor Summary
Constructors Constructor Description FileRepository()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetChunkFilename(@NonNull Chunk chunk)java.nio.file.PathgetChunkPath(@NonNull Chunk chunk)Chunkload(com.simsilica.mathd.Vec3i location)Loads the chunk for the given chunk location.booleansave(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:ChunkRepositoryLoads the chunk for the given chunk location.- Specified by:
loadin 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:ChunkRepositorySaves the chunk- Specified by:
savein 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)
-
-