Only resize if expanding

This commit is contained in:
Jesse Boyd 2017-08-02 13:20:47 +10:00
parent 371f61c36b
commit fb3c8cc5e1
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -238,10 +238,12 @@ public class DiskOptimizedClipboard extends FaweClipboard implements Closeable {
area = width * length; area = width * length;
volume = width * length * height; volume = width * length * height;
long size = width * height * length * 2l + HEADER_SIZE + (hasBiomes() ? area : 0); long size = width * height * length * 2l + HEADER_SIZE + (hasBiomes() ? area : 0);
close(); if (braf.length() < size) {
this.braf = new RandomAccessFile(file, "rw"); close();
braf.setLength(size); this.braf = new RandomAccessFile(file, "rw");
init(); braf.setLength(size);
init();
}
mbb.putChar(2, (char) width); mbb.putChar(2, (char) width);
mbb.putChar(4, (char) height); mbb.putChar(4, (char) height);
mbb.putChar(6, (char) length); mbb.putChar(6, (char) length);