Class 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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileRepository

        public FileRepository()
    • 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 interface ChunkRepository
        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 interface ChunkRepository
        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)