Class RegionFile

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class RegionFile
    extends java.lang.Object
    implements java.lang.AutoCloseable
    • Field Detail

      • LOGGER

        private static final org.apache.logging.log4j.Logger LOGGER
      • PADDING_BUFFER

        private static final java.nio.ByteBuffer PADDING_BUFFER
      • file

        private final java.nio.channels.FileChannel file
      • externalFileDir

        private final java.nio.file.Path externalFileDir
      • header

        private final java.nio.ByteBuffer header
      • offsets

        private final java.nio.IntBuffer offsets
      • timestamps

        private final java.nio.IntBuffer timestamps
    • Constructor Detail

      • RegionFile

        public RegionFile​(java.io.File p_i231893_1_,
                          java.io.File p_i231893_2_,
                          boolean p_i231893_3_)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • RegionFile

        public RegionFile​(java.nio.file.Path p_i231894_1_,
                          java.nio.file.Path p_i231894_2_,
                          RegionFileVersion p_i231894_3_,
                          boolean p_i231894_4_)
                   throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • getExternalChunkPath

        private java.nio.file.Path getExternalChunkPath​(ChunkPos p_227145_1_)
      • getChunkDataInputStream

        @Nullable
        public java.io.DataInputStream getChunkDataInputStream​(ChunkPos p_222666_1_)
                                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • isExternalStreamChunk

        private static boolean isExternalStreamChunk​(byte p_227130_0_)
      • getExternalChunkVersion

        private static byte getExternalChunkVersion​(byte p_227141_0_)
      • createChunkInputStream

        @Nullable
        private java.io.DataInputStream createChunkInputStream​(ChunkPos p_227134_1_,
                                                               byte p_227134_2_,
                                                               java.io.InputStream p_227134_3_)
                                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • createExternalChunkInputStream

        @Nullable
        private java.io.DataInputStream createExternalChunkInputStream​(ChunkPos p_227133_1_,
                                                                       byte p_227133_2_)
                                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • createStream

        private static java.io.ByteArrayInputStream createStream​(java.nio.ByteBuffer p_227137_0_,
                                                                 int p_227137_1_)
      • packSectorOffset

        private int packSectorOffset​(int p_227132_1_,
                                     int p_227132_2_)
      • getNumSectors

        private static int getNumSectors​(int p_227131_0_)
      • getSectorNumber

        private static int getSectorNumber​(int p_227142_0_)
      • sizeToSectors

        private static int sizeToSectors​(int p_227144_0_)
      • doesChunkExist

        public boolean doesChunkExist​(ChunkPos p_222662_1_)
      • getChunkDataOutputStream

        public java.io.DataOutputStream getChunkDataOutputStream​(ChunkPos p_222661_1_)
                                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • flush

        public void flush()
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • write

        protected void write​(ChunkPos p_227135_1_,
                             java.nio.ByteBuffer p_227135_2_)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • createExternalStub

        private java.nio.ByteBuffer createExternalStub()
      • writeToExternalFile

        private RegionFile.ICompleteCallback writeToExternalFile​(java.nio.file.Path p_227138_1_,
                                                                 java.nio.ByteBuffer p_227138_2_)
                                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writeHeader

        private void writeHeader()
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getOffset

        private int getOffset​(ChunkPos p_222660_1_)
      • hasChunk

        public boolean hasChunk​(ChunkPos p_222667_1_)
      • getOffsetIndex

        private static int getOffsetIndex​(ChunkPos p_222668_0_)
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Throws:
        java.io.IOException
      • padToFullSector

        private void padToFullSector()
                              throws java.io.IOException
        Throws:
        java.io.IOException