Fixed ListTag

This commit is contained in:
Steveice10 2012-12-03 16:08:14 -08:00
parent dd7a7522ff
commit 643639c051
2 changed files with 4 additions and 6 deletions

View File

@ -267,6 +267,7 @@ public final class NBTInputStream implements Closeable {
return new ObjectTag(name, o);
case NBTConstants.TYPE_SHORT_ARRAY:
long time = System.currentTimeMillis();
length = is.readInt();
short[] shorts = new short[length];
@ -274,6 +275,7 @@ public final class NBTInputStream implements Closeable {
shorts[i] = is.readShort();
}
System.out.println("Took " + (System.currentTimeMillis() - time) + "ms to read a short array.");
return new ShortArrayTag(name, shorts);
case NBTConstants.TYPE_STRING_ARRAY:
length = is.readInt();

View File

@ -35,15 +35,11 @@ package ch.spacebase.opennbt.tag;
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import ch.spacebase.opennbt.NBTUtils;
/**
* The <code>TAG_List</code> tag.
*/
@ -77,7 +73,7 @@ public final class ListTag<T extends Tag> extends Tag implements Iterable<T> {
public ListTag(String name, Class<T> type, List<T> value) {
super(name);
this.type = type;
this.value = Collections.unmodifiableList(value);
this.value = value;
}
/**
@ -90,7 +86,7 @@ public final class ListTag<T extends Tag> extends Tag implements Iterable<T> {
@Override
public List<T> getValue() {
return value;
return new ArrayList<T>(value);
}
public boolean add(T value) {