Class TagWriter

java.lang.Object
com.viaversion.nbt.io.TagWriter

public final class TagWriter extends Object
Reusable NBT tag writer.
See Also:
  • Constructor Details

    • TagWriter

      public TagWriter()
  • Method Details

    • named

      public TagWriter named()
      Sets this writer to write a named tag.
      Returns:
      self
    • write

      public void write(DataOutput out, Tag tag) throws IOException
      Writes the tag to the given data output.
      Parameters:
      out - output stream to write to
      tag - tag to write
      Throws:
      IOException - if an I/O error occurs
    • write

      public void write(OutputStream out, Tag tag) throws IOException
      Writes the tag to the given output stream.
      Parameters:
      out - output stream to write to
      tag - tag to write
      Throws:
      IOException - if an I/O error occurs
    • write

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