Class TagReader<T extends Tag>

java.lang.Object
com.viaversion.nbt.io.TagReader<T>
Type Parameters:
T - the expected tag type

public final class TagReader<T extends Tag> extends Object
NBT tag reader.
See Also:
  • Method Details

    • tagLimiter

      public TagReader<T> tagLimiter(TagLimiter tagLimiter)
      Sets the tag limiter to use per read tag, making the reader no longer thread-safe.
      Parameters:
      tagLimiter - the tag limiter to use
      Returns:
      self
    • named

      public TagReader<T> named()
      Sets this reader to read a named tag.
      Returns:
      self
    • read

      public T read(DataInput in) throws IOException
      Reads the tag from the given data output.
      Parameters:
      in - data input to read from
      Throws:
      IOException - if an I/O error occurs
    • read

      public T read(InputStream in) throws IOException
      Reads a tag from the given input stream.
      Parameters:
      in - input stream to read from
      Returns:
      the read tag
      Throws:
      IOException - if an I/O error occurs
    • read

      public T read(Path path, boolean compressed) throws IOException
      Reads a tag from the given path. At least so far, the standard format is always named, so make sure to call named().
      Parameters:
      path - path to read from
      compressed - whether the file is compressed
      Throws:
      IOException - if an I/O error occurs