it worked...
This commit is contained in:
parent
fda2afbd49
commit
748ed70f50
2 changed files with 28 additions and 7 deletions
|
@ -175,6 +175,8 @@ public class BackupIO
|
||||||
NBTCompressedStreamTools.a(dataInput),
|
NBTCompressedStreamTools.a(dataInput),
|
||||||
(java.io.DataOutput) dataOutput);
|
(java.io.DataOutput) dataOutput);
|
||||||
|
|
||||||
|
dataOutput.close();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.RandomAccessFile;
|
import java.io.RandomAccessFile;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -89,6 +90,7 @@ public final class RegionFileCache
|
||||||
catch (IOException e) { e.printStackTrace(); }
|
catch (IOException e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
RegionFileCache.cache.clear();
|
RegionFileCache.cache.clear();
|
||||||
|
RegionFileCache.cacheRAF.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,16 +135,34 @@ public final class RegionFileCache
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*-------------------------------RandomAccessFiles-------------------------------*/
|
/*---------------------------------Chunk Access---------------------------------*/
|
||||||
|
|
||||||
/* RegionFiles keep their actual .mca files private, but those bytes can be useful
|
/* RegionFiles keep their actual .mca files private, but those bytes can be useful
|
||||||
* to read. The auxiliary cache below stores, for each cached RegionFile, a read-only
|
* to read. The auxiliary cache below stores, for each cached RegionFile, a read-only
|
||||||
* RandomAccessFile pointing to the .mca file.
|
* RandomAccessFile pointing to the .mca file, and an int[] storing the offset values
|
||||||
|
* for each chunk's bytes within the file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static Map<RegionFile,
|
private static Map<RegionFile,
|
||||||
RandomAccessFile> cacheRAF = new HashMap<RegionFile,
|
ChunkAccess> cacheRAF = new HashMap<RegionFile,
|
||||||
RandomAccessFile>();
|
ChunkAccess>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO
|
||||||
|
*/
|
||||||
|
public static class ChunkAccess
|
||||||
|
{
|
||||||
|
//private static Field offsetField = RegionFile.class.getDeclaredField("d");
|
||||||
|
|
||||||
|
final RandomAccessFile bytes;
|
||||||
|
final int[] offsets;
|
||||||
|
|
||||||
|
ChunkAccess(RandomAccessFile bytes, int[] chunkOffsets)
|
||||||
|
{
|
||||||
|
this.bytes = bytes;
|
||||||
|
this.offsets = chunkOffsets;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* TODO
|
||||||
|
@ -152,8 +172,7 @@ public final class RegionFileCache
|
||||||
*/
|
*/
|
||||||
private static void cacheRAF(File file, RegionFile regionFile)
|
private static void cacheRAF(File file, RegionFile regionFile)
|
||||||
{
|
{
|
||||||
try { cacheRAF.put(regionFile, new RandomAccessFile(file, "r")); }
|
|
||||||
catch (FileNotFoundException e) { e.printStackTrace(); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -165,7 +184,7 @@ public final class RegionFileCache
|
||||||
*/
|
*/
|
||||||
public static RandomAccessFile getRAF(RegionFile regionFile)
|
public static RandomAccessFile getRAF(RegionFile regionFile)
|
||||||
{
|
{
|
||||||
return cacheRAF.get(regionFile);
|
return null;//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue