/** * Read nbt tag from this stream using given limiter. * * @param limiter limiter to be used. * @return readed tag from stream. * @throws IOException if any read operation failed. */ public NbtTag readTag(final NbtLimiter limiter) throws IOException { final byte type = this.readByte(); final NbtTagType tagType = NbtTagType.valueOf(type); if (tagType == null) { throw new IOException("Invalid NBT tag: Found unknown tag type " + type + "."); } return this.readTag(tagType, false, limiter); }
/** * Read nbt tag from this stream using given limiter. * * @param type type of tag to read. * @param anonymous if tag have name. * @param limiter limiter to be used. * @return readed tag from stream. * @throws IOException if any read operation failed. */ public NbtTag readTag(final NbtTagType type, final boolean anonymous, final NbtLimiter limiter) throws IOException { final NbtTag tag = type.newInstance(); tag.read(this, anonymous, limiter); return tag; }