Skip to content

Class TagWriter

Namespace: Void.Minecraft.Nbt
Assembly: Void.Minecraft.dll

Provides methods for writing NBT tags to a stream.

public class TagWriter : TagIO, IDisposable

Inheritance

objectTagIOTagWriter

Derived

BufferedTagWriter

Implements

IDisposable

Inherited Members

TagIO.BaseStream, TagIO.SwapEndian, TagIO.UseVarInt, TagIO.ZigZagEncoding, TagIO.FormatOptions, TagIO.Dispose(), TagIO.DisposeAsync(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

TagWriter(Stream, FormatOptions, bool)

Creates a new instance of the class from the given stream.

public TagWriter(Stream stream, FormatOptions options, bool leaveOpen = false)

Parameters

stream Stream

A instance that the writer will be writing to.

options FormatOptions

Bitwise flags to configure how data should be handled for compatibility between different specifications.

leaveOpen bool

to leave the stream object open after disposing the object; otherwise, false.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public override void Dispose()

DisposeAsync()

Asynchronously releases the unmanaged resources used by the .

public override ValueTask DisposeAsync()

Returns

ValueTask

WriteBuilder(TagBuilder)

Convenience method to build and write a instance to the underlying stream.

public virtual void WriteBuilder(TagBuilder builder)

Parameters

builder TagBuilder

A instance to write.

WriteByte(ByteTag)

Writes a to the stream.

public virtual void WriteByte(ByteTag tag)

Parameters

tag ByteTag

The instance to write.

WriteByteArray(ByteArrayTag)

Writes a to the stream.

public virtual void WriteByteArray(ByteArrayTag tag)

Parameters

tag ByteArrayTag

The instance to write.

WriteCompound(CompoundTag)

Writes a to the stream.

public virtual void WriteCompound(CompoundTag tag)

Parameters

tag CompoundTag

The instance to write.

WriteDouble(DoubleTag)

Writes a to the stream.

public virtual void WriteDouble(DoubleTag tag)

Parameters

tag DoubleTag

The instance to write.

WriteEndTag(EndTag?)

public virtual void WriteEndTag(EndTag? tag = null)

Parameters

tag EndTag?

WriteFloat(FloatTag)

Writes a to the stream.

public virtual void WriteFloat(FloatTag tag)

Parameters

tag FloatTag

The instance to write.

WriteInt(IntTag)

Writes a to the stream.

public virtual void WriteInt(IntTag tag)

Parameters

tag IntTag

The instance to write.

WriteIntArray(IntArrayTag)

Writes a to the stream.

public virtual void WriteIntArray(IntArrayTag tag)

Parameters

tag IntArrayTag

The instance to write.

WriteList(ListTag)

Writes a to the stream.

public virtual void WriteList(ListTag tag)

Parameters

tag ListTag

The instance to write.

WriteLong(LongTag)

Writes a to the stream.

public virtual void WriteLong(LongTag tag)

Parameters

tag LongTag

The instance to write.

WriteLongArray(LongArrayTag)

Writes a to the stream.

public virtual void WriteLongArray(LongArrayTag tag)

Parameters

tag LongArrayTag

The instance to write.

WriteShort(ShortTag)

Writes a to the stream.

public virtual void WriteShort(ShortTag tag)

Parameters

tag ShortTag

The instance to write.

WriteString(StringTag)

Writes a to the stream.

public virtual void WriteString(StringTag tag)

Parameters

tag StringTag

The instance to write.

WriteTag(Tag)

Writes the given to the stream.

public void WriteTag(Tag tag)

Parameters

tag Tag

The instance to be written.

Exceptions

ArgumentOutOfRangeException

Thrown when the tag type is unrecognized.

WriteTagAsync(Tag)

Asynchronously writes the given to the stream.

public Task WriteTagAsync(Tag tag)

Parameters

tag Tag

The instance to be written.

Returns

Task

Exceptions

ArgumentOutOfRangeException

Thrown when the tag type is unrecognized.