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) class
RegionFile.ChunkBuffer
(package private) static interface
RegionFile.OutputAction
-
Field Summary
Fields Modifier and Type Field Description private FileChannel
channel
private Path
directory
private ByteBuffer
header
private static Logger
LOGGER
private ChunkStreamVersion
outputChunkStreamVersion
private IntBuffer
saveTimes
private IntBuffer
sectorData
protected SectorMap
sectors
private static ByteBuffer
ZERO
-
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 void
close()
private void
fillLastSector()
DataInputStream
getChunkInputStream(ChunkPos pos)
DataOutputStream
getChunkOutputStream(ChunkPos pos)
private static byte
getChunkStreamVersionId(byte byte2)
private Path
getExternalChunkPath(ChunkPos chunkPos)
private static int
getIndex(ChunkPos pos)
private static ByteArrayInputStream
getInputStream(ByteBuffer buffer, int length)
private static int
getOffset(int sectorData)
private static int
getSectorCount(int byteCount)
private int
getSectorData(ChunkPos pos)
private static int
getSize(int sectorData)
boolean
hasChunk(ChunkPos pos)
private static boolean
hasChunkStreamVersionId(byte byte2)
boolean
isChunkValid(ChunkPos pos)
private ByteBuffer
method_22406()
private DataInputStream
method_22408(ChunkPos chunkPos, byte byte2)
private DataInputStream
method_22409(ChunkPos chunkPos, byte byte2, InputStream inputStream)
void
method_26981()
private static int
method_31739()
void
method_31740(ChunkPos chunkPos)
private int
packSectorData(int offset, int size)
protected void
writeChunk(ChunkPos pos, ByteBuffer byteBuffer)
private void
writeHeader()
private RegionFile.OutputAction
writeSafely(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:
close
in interfaceAutoCloseable
- Throws:
IOException
-
fillLastSector
- Throws:
IOException
-