public class RegionFile
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) class |
RegionFile.ChunkBuffer |
Modifier and Type | Field and Description |
---|---|
private int[] |
chunkTimestamps |
private java.io.RandomAccessFile |
dataFile |
private static byte[] |
emptySector |
private java.io.File |
fileName |
private long |
lastModified |
private int[] |
offsets |
private java.util.List<java.lang.Boolean> |
sectorFree |
private int |
sizeDelta
McRegion sizeDelta
|
Constructor and Description |
---|
RegionFile(java.io.File fileNameIn) |
Modifier and Type | Method and Description |
---|---|
void |
close()
close this RegionFile and prevent further writes
|
java.io.DataInputStream |
getChunkDataInputStream(int x,
int z)
Returns an uncompressed chunk stream from the region file.
|
java.io.DataOutputStream |
getChunkDataOutputStream(int x,
int z)
Returns an output stream used to write chunk data.
|
private int |
getOffset(int x,
int z)
args: x, z - get chunk's offset in region file
|
boolean |
isChunkSaved(int x,
int z)
args: x, z, - true if chunk has been saved / converted
|
private boolean |
outOfBounds(int x,
int z)
args: x, z - check region bounds
|
private void |
setChunkTimestamp(int x,
int z,
int timestamp)
args: x, z, timestamp - sets the chunk's write timestamp
|
private void |
setOffset(int x,
int z,
int offset)
args: x, z, offset - sets the chunk's offset in the region file
|
private void |
write(int sectorNumber,
byte[] data,
int length)
args: sectorNumber, data, length - write the chunk data to this RegionFile
|
protected void |
write(int x,
int z,
byte[] data,
int length)
args: x, z, data, length - write chunk data at (x, z) to disk
|
private static final byte[] emptySector
private final java.io.File fileName
private java.io.RandomAccessFile dataFile
private final int[] offsets
private final int[] chunkTimestamps
private java.util.List<java.lang.Boolean> sectorFree
private int sizeDelta
private long lastModified
public java.io.DataInputStream getChunkDataInputStream(int x, int z)
public java.io.DataOutputStream getChunkDataOutputStream(int x, int z)
protected void write(int x, int z, byte[] data, int length)
private void write(int sectorNumber, byte[] data, int length) throws java.io.IOException
java.io.IOException
private boolean outOfBounds(int x, int z)
private int getOffset(int x, int z)
public boolean isChunkSaved(int x, int z)
private void setOffset(int x, int z, int offset) throws java.io.IOException
java.io.IOException
private void setChunkTimestamp(int x, int z, int timestamp) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException