Class FileRepository

java.lang.Object
com.rvandoosselaer.blocks.FileRepository
All Implemented Interfaces:
ChunkRepository

public class FileRepository extends 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 Details

  • Constructor Details

    • FileRepository

      public FileRepository()
  • Method Details

    • 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
    • load

      public Chunk load(String filename)
    • 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
    • save

      public boolean save(Chunk chunk, String filename)
    • getChunkPath

      public Path getChunkPath(@NonNull @NonNull Chunk chunk)
    • getChunkFilename

      public static String getChunkFilename(@NonNull @NonNull Chunk chunk)