Added .tar and .tar.* support, *maybe*.

This commit is contained in:
sk89q
2010-11-05 22:50:22 -07:00
parent 49739bab76
commit 5fc97f0f7d
3 changed files with 30 additions and 8 deletions

View File

@@ -54,13 +54,21 @@ public class Snapshot {
* @return
* @throws IOException
*/
public ChunkStore getChunkStore() throws IOException {
public ChunkStore getChunkStore() throws IOException, DataException {
if (file.getName().toLowerCase().endsWith(".zip")) {
try {
return new TrueZipAlphaChunkStore(file);
} catch (NoClassDefFoundError e) {
return new ZippedAlphaChunkStore(file);
}
} else if (file.getName().toLowerCase().endsWith(".tar.bz2")
|| file.getName().toLowerCase().endsWith(".tar.gz")
|| file.getName().toLowerCase().endsWith(".tar")) {
try {
return new TrueZipAlphaChunkStore(file);
} catch (NoClassDefFoundError e) {
throw new DataException("TrueZIP is required for .tar support");
}
} else {
return new AlphaChunkStore(file);
}