Package net.minecraft.world.storage
Class RegionFile
java.lang.Object
net.minecraft.world.storage.RegionFile
- All Implemented Interfaces:
AutoCloseable
public class RegionFile extends Object implements AutoCloseable
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classRegionFile.ChunkBuffer(package private) static interfaceRegionFile.OutputAction -
Field Summary
Fields Modifier and Type Field Description private FileChannelchannelprivate Pathdirectoryprivate ByteBufferheaderprivate static LoggerLOGGERprivate ChunkStreamVersionoutputChunkStreamVersionprivate IntBuffersaveTimesprivate IntBuffersectorDataprotected SectorMapsectorsprivate static ByteBufferZERO -
Constructor Summary
Constructors Constructor Description RegionFile(File file, File directory, boolean dsync)RegionFile(Path file, Path directory, ChunkStreamVersion outputChunkStreamVersion, boolean dsync) -
Method Summary
Modifier and Type Method Description voidclose()private voidfillLastSector()DataInputStreamgetChunkInputStream(ChunkPos pos)DataOutputStreamgetChunkOutputStream(ChunkPos pos)private static bytegetChunkStreamVersionId(byte byte2)private PathgetExternalChunkPath(ChunkPos chunkPos)private static intgetIndex(ChunkPos pos)private static ByteArrayInputStreamgetInputStream(ByteBuffer buffer, int length)private static intgetOffset(int sectorData)private static intgetSectorCount(int byteCount)private intgetSectorData(ChunkPos pos)private static intgetSize(int sectorData)booleanhasChunk(ChunkPos pos)private static booleanhasChunkStreamVersionId(byte byte2)booleanisChunkValid(ChunkPos pos)private ByteBuffermethod_22406()private DataInputStreammethod_22408(ChunkPos chunkPos, byte byte2)private DataInputStreammethod_22409(ChunkPos chunkPos, byte byte2, InputStream inputStream)voidmethod_26981()private static intmethod_31739()voidmethod_31740(ChunkPos chunkPos)private intpackSectorData(int offset, int size)protected voidwriteChunk(ChunkPos pos, ByteBuffer byteBuffer)private voidwriteHeader()private RegionFile.OutputActionwriteSafely(Path path, ByteBuffer byteBuffer)
-
Field Details
-
LOGGER
-
ZERO
-
channel
-
directory
-
outputChunkStreamVersion
-
header
-
sectorData
-
saveTimes
-
sectors
-
-
Constructor Details
-
RegionFile
- Throws:
IOException
-
RegionFile
public RegionFile(Path file, Path directory, ChunkStreamVersion outputChunkStreamVersion, boolean dsync) throws IOException- Throws:
IOException
-
-
Method Details
-
getExternalChunkPath
-
getChunkInputStream
- Throws:
IOException
-
method_31739
private static int method_31739() -
hasChunkStreamVersionId
private static boolean hasChunkStreamVersionId(byte byte2) -
getChunkStreamVersionId
private static byte getChunkStreamVersionId(byte byte2) -
method_22409
@Nullable private DataInputStream method_22409(ChunkPos chunkPos, byte byte2, InputStream inputStream) throws IOException- Throws:
IOException
-
method_22408
- Throws:
IOException
-
getInputStream
-
packSectorData
private int packSectorData(int offset, int size) -
getSize
private static int getSize(int sectorData) -
getOffset
private static int getOffset(int sectorData) -
getSectorCount
private static int getSectorCount(int byteCount) -
isChunkValid
-
getChunkOutputStream
- Throws:
IOException
-
method_26981
- Throws:
IOException
-
method_31740
- Throws:
IOException
-
writeChunk
- Throws:
IOException
-
method_22406
-
writeSafely
- Throws:
IOException
-
writeHeader
- Throws:
IOException
-
getSectorData
-
hasChunk
-
getIndex
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
fillLastSector
- Throws:
IOException
-