Class RegionFile
java.lang.Object
net.minecraft.world.level.chunk.storage.RegionFile
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classprivate static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final Stringprivate static final intprivate final Pathprivate final FileChannelprivate final ByteBufferprivate static final intprivate final RegionStorageInfoprivate static final org.slf4j.Loggerprivate final IntBufferprivate static final ByteBufferprivate final Pathprivate static final intprotected static final intprivate final IntBufferprotected final RegionBitmapprivate final RegionFileVersion -
Constructor Summary
ConstructorsConstructorDescriptionRegionFile(RegionStorageInfo info, Path path, Path externalFileDir, boolean sync) RegionFile(RegionStorageInfo info, Path path, Path externalFileDir, RegionFileVersion version, boolean sync) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidclose()private @Nullable DataInputStreamcreateChunkInputStream(ChunkPos pos, byte versionId, InputStream chunkStream) private @Nullable DataInputStreamcreateExternalChunkInputStream(ChunkPos pos, byte versionId) private ByteBufferprivate static ByteArrayInputStreamcreateStream(ByteBuffer buffer, int length) booleandoesChunkExist(ChunkPos pos) voidflush()@Nullable DataInputStreamprivate Pathprivate static bytegetExternalChunkVersion(byte version) private static intgetNumSectors(int offset) private intprivate static intgetOffsetIndex(ChunkPos pos) getPath()private static intgetSectorNumber(int offset) private static intbooleanprivate static booleanisExternalStreamChunk(byte version) private intpackSectorOffset(int index, int size) private voidprivate static intsizeToSectors(int size) protected voidwrite(ChunkPos pos, ByteBuffer data) private voidprivate RegionFile.CommitOpwriteToExternalFile(Path path, ByteBuffer data)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
SECTOR_BYTES
private static final int SECTOR_BYTES- See Also:
-
SECTOR_INTS
protected static final int SECTOR_INTS- See Also:
-
CHUNK_HEADER_SIZE
private static final int CHUNK_HEADER_SIZE- See Also:
-
HEADER_OFFSET
private static final int HEADER_OFFSET- See Also:
-
PADDING_BUFFER
-
EXTERNAL_FILE_EXTENSION
- See Also:
-
EXTERNAL_STREAM_FLAG
private static final int EXTERNAL_STREAM_FLAG- See Also:
-
EXTERNAL_CHUNK_THRESHOLD
private static final int EXTERNAL_CHUNK_THRESHOLD- See Also:
-
CHUNK_NOT_PRESENT
private static final int CHUNK_NOT_PRESENT- See Also:
-
info
-
path
-
file
-
externalFileDir
-
version
-
header
-
offsets
-
timestamps
-
usedSectors
-
-
Constructor Details
-
RegionFile
public RegionFile(RegionStorageInfo info, Path path, Path externalFileDir, boolean sync) throws IOException - Throws:
IOException
-
RegionFile
public RegionFile(RegionStorageInfo info, Path path, Path externalFileDir, RegionFileVersion version, boolean sync) throws IOException - Throws:
IOException
-
-
Method Details
-
getPath
-
getExternalChunkPath
-
getChunkDataInputStream
- Throws:
IOException
-
getTimestamp
private static int getTimestamp() -
isExternalStreamChunk
private static boolean isExternalStreamChunk(byte version) -
getExternalChunkVersion
private static byte getExternalChunkVersion(byte version) -
createChunkInputStream
private @Nullable DataInputStream createChunkInputStream(ChunkPos pos, byte versionId, InputStream chunkStream) throws IOException - Throws:
IOException
-
createExternalChunkInputStream
private @Nullable DataInputStream createExternalChunkInputStream(ChunkPos pos, byte versionId) throws IOException - Throws:
IOException
-
createStream
-
packSectorOffset
private int packSectorOffset(int index, int size) -
getNumSectors
private static int getNumSectors(int offset) -
getSectorNumber
private static int getSectorNumber(int offset) -
sizeToSectors
private static int sizeToSectors(int size) -
doesChunkExist
-
getChunkDataOutputStream
- Throws:
IOException
-
flush
- Throws:
IOException
-
clear
- Throws:
IOException
-
write
- Throws:
IOException
-
createExternalStub
-
writeToExternalFile
- Throws:
IOException
-
writeHeader
- Throws:
IOException
-
getOffset
-
hasChunk
-
getOffsetIndex
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
padToFullSector
- Throws:
IOException
-