Class StringTag

java.lang.Object
com.viaversion.nbt.tag.StringTag
All Implemented Interfaces:
Tag

public final class StringTag extends Object implements Tag
A tag containing a string.
  • Field Details

  • Constructor Details

    • StringTag

      public StringTag()
      Creates a tag.
    • StringTag

      public StringTag(String value)
      Creates a tag.
      Parameters:
      value - The value of the tag.
  • Method Details

    • read

      public static StringTag read(DataInput in, TagLimiter tagLimiter) throws IOException
      Throws:
      IOException
    • getValue

      public String getValue()
      Description copied from interface: Tag
      Returns the value of this tag.
      Specified by:
      getValue in interface Tag
      Returns:
      value of this tag
    • asRawString

      public String asRawString()
      Description copied from interface: Tag
      Returns the raw string representation of the value of this tag. For SNBT, use SNBT.serialize(Tag).
      Specified by:
      asRawString in interface Tag
      Returns:
      raw string representation of the value of this tag
    • setValue

      public void setValue(String value)
      Sets the value of this tag.
      Parameters:
      value - New value of this tag.
    • write

      public void write(DataOutput out) throws IOException
      Description copied from interface: Tag
      Writes this tag to an output stream.
      Specified by:
      write in interface Tag
      Parameters:
      out - data output to write to
      Throws:
      IOException - if an I/O error occurs
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • copy

      public StringTag copy()
      Description copied from interface: Tag
      Returns a copy of this tag.
      Specified by:
      copy in interface Tag
      Returns:
      a copy of this tag
    • getTagId

      public int getTagId()
      Description copied from interface: Tag
      Returns the NBT tag id of this tag type, used in I/O.
      Specified by:
      getTagId in interface Tag
      Returns:
      ID of the tag this class represents
    • toString

      public String toString()
      Overrides:
      toString in class Object