public class RegionFile extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
(package private) class |
RegionFile.ChunkBuffer |
(package private) static interface |
RegionFile.OutputAction |
Modifier and Type | Field and 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 and Description |
---|
RegionFile(File file,
File directory,
boolean dsync) |
RegionFile(Path file,
Path directory,
ChunkStreamVersion outputChunkStreamVersion,
boolean dsync) |
Modifier and Type | Method and 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 int |
packSectorData(int offset,
int size) |
protected void |
writeChunk(ChunkPos pos,
ByteBuffer byteBuffer) |
private void |
writeHeader() |
private RegionFile.OutputAction |
writeSafely(Path path,
ByteBuffer byteBuffer) |
private static final Logger LOGGER
private static final ByteBuffer ZERO
private final FileChannel channel
private final Path directory
private final ChunkStreamVersion outputChunkStreamVersion
private final ByteBuffer header
private final IntBuffer sectorData
private final IntBuffer saveTimes
protected final SectorMap sectors
public RegionFile(File file, File directory, boolean dsync) throws IOException
IOException
public RegionFile(Path file, Path directory, ChunkStreamVersion outputChunkStreamVersion, boolean dsync) throws IOException
IOException
@Nullable public DataInputStream getChunkInputStream(ChunkPos pos) throws IOException
IOException
private static boolean hasChunkStreamVersionId(byte byte2)
private static byte getChunkStreamVersionId(byte byte2)
@Nullable private DataInputStream method_22409(ChunkPos chunkPos, byte byte2, InputStream inputStream) throws IOException
IOException
@Nullable private DataInputStream method_22408(ChunkPos chunkPos, byte byte2) throws IOException
IOException
private static ByteArrayInputStream getInputStream(ByteBuffer buffer, int length)
private int packSectorData(int offset, int size)
private static int getSize(int sectorData)
private static int getOffset(int sectorData)
private static int getSectorCount(int byteCount)
public boolean isChunkValid(ChunkPos pos)
public DataOutputStream getChunkOutputStream(ChunkPos pos) throws IOException
IOException
public void method_26981() throws IOException
IOException
protected void writeChunk(ChunkPos pos, ByteBuffer byteBuffer) throws IOException
IOException
private ByteBuffer method_22406()
private RegionFile.OutputAction writeSafely(Path path, ByteBuffer byteBuffer) throws IOException
IOException
private void writeHeader() throws IOException
IOException
private int getSectorData(ChunkPos pos)
public boolean hasChunk(ChunkPos pos)
private static int getIndex(ChunkPos pos)
public void close() throws IOException
close
in interface AutoCloseable
IOException
private void fillLastSector() throws IOException
IOException