/** * Reads an NBT {@link Tag} from the stream. * * @param depth The depth of this tag. * @return The tag that was read. * @throws java.io.IOException if an I/O error occurs. */ private Tag readTag(int depth) throws IOException { int typeId = is.readByte() & 0xFF; TagType type = TagType.getById(typeId); String name; if (type != TagType.TAG_END) { int nameLength = is.readShort() & 0xFFFF; byte[] nameBytes = new byte[nameLength]; is.readFully(nameBytes); name = new String(nameBytes, NBTConstants.CHARSET.name()); } else { name = ""; } return readTagPayload(type, name, depth); }
/** * Reads an NBT {@link Tag} from the stream. * * @param depth The depth of this tag. * @return The tag that was read. * @throws java.io.IOException if an I/O error occurs. */ private Tag readTag(int depth) throws IOException { int typeId = is.readByte() & 0xFF; TagType type = TagType.getById(typeId); String name; if (type != TagType.TAG_END) { int nameLength = is.readShort() & 0xFFFF; byte[] nameBytes = new byte[nameLength]; is.readFully(nameBytes); name = new String(nameBytes, NBTConstants.CHARSET.name()); } else { name = ""; } return readTagPayload(type, name, depth); }
/** * Reads an NBT {@link Tag} from the stream. * * @param depth The depth of this tag. * @return The tag that was read. * @throws java.io.IOException if an I/O error occurs. */ private Tag readTag(int depth) throws IOException { int typeId = is.readByte() & 0xFF; TagType type = TagType.getById(typeId); String name; if (type != TagType.TAG_END) { int nameLength = is.readShort() & 0xFFFF; byte[] nameBytes = new byte[nameLength]; is.readFully(nameBytes); name = new String(nameBytes, NBTConstants.CHARSET.name()); } else { name = ""; } return readTagPayload(type, name, depth); }
List<Tag> tagList = new ArrayList<Tag>(length); for (int i = 0; i < length; i++) { Tag tag = readTagPayload(childType, "", depth + 1); if (tag instanceof EndTag) { throw new IOException("TAG_End not permitted in a list.");
List<Tag> tagList = new ArrayList<Tag>(length); for (int i = 0; i < length; i++) { Tag tag = readTagPayload(childType, "", depth + 1); if (tag instanceof EndTag) { throw new IOException("TAG_End not permitted in a list.");
List<Tag> tagList = new ArrayList<Tag>(length); for (int i = 0; i < length; i++) { Tag tag = readTagPayload(childType, "", depth + 1); if (tag instanceof EndTag) { throw new IOException("TAG_End not permitted in a list.");