Class Tag
java.lang.Object
com.ardor3d.example.craft.converter.Tag
NBT IO class
- See Also:
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a tag to a TAG_List or a TAG_Compound.findNextTagByName
(String name, Tag found) Find the first nested tag with specified name in a TAG_List or TAG_Compound after a tag with the same name.findTagByName
(String name) Find the first nested tag with specified name in a TAG_Compound.getName()
getType()
getValue()
void
Add a tag to a TAG_List or a TAG_Compound at the specified index.void
print()
Print the NBT structure to System.outstatic Tag
readFrom
(DataInputStream dis) Read a tag and its nested tags from an InputStream.void
removeSubTag
(Tag tag) Remove a tag from a TAG_List or a TAG_Compound.removeTag
(int index) Remove a tag from a TAG_List or a TAG_Compound at the specified index.void
writeTo
(OutputStream os) Read a tag and its nested tags from an InputStream.
-
Constructor Details
-
Tag
Create a new TAG_List or TAG_Compound NBT tag.- Parameters:
type
- either TAG_List or TAG_Compoundname
- name for the new tag or null to create an unnamed tag.value
- list of tags to add to the new tag.
-
Tag
Create a new TAG_List with an empty list. UseaddTag(Tag)
to add tags later.- Parameters:
name
- name for this tag or null to create an unnamed tag.listType
- type of the elements in this empty list.
-
Tag
Create a new NBT tag.
-
-
Method Details
-
getType
-
getName
-
getValue
-
getListType
-
addTag
Add a tag to a TAG_List or a TAG_Compound.- Parameters:
tag
- the tag to add
-
insertTag
Add a tag to a TAG_List or a TAG_Compound at the specified index.- Parameters:
tag
- the tag to insertindex
- the index the index of insertion
-
removeTag
Remove a tag from a TAG_List or a TAG_Compound at the specified index.- Parameters:
index
- the index the index of removal- Returns:
- the removed tag
-
removeSubTag
Remove a tag from a TAG_List or a TAG_Compound. If the tag is not a child of this tag then nested tags are searched.- Parameters:
tag
- tag to look for
-
findTagByName
Find the first nested tag with specified name in a TAG_Compound.- Parameters:
name
- the name to look for. May be null to look for unnamed tags.- Returns:
- the first nested tag that has the specified name.
-
findNextTagByName
Find the first nested tag with specified name in a TAG_List or TAG_Compound after a tag with the same name.- Parameters:
name
- the name to look for. May be null to look for unnamed tags.found
- the previously found tag with the same name.- Returns:
- the first nested tag that has the specified name after the previously found tag.
-
readFrom
Read a tag and its nested tags from an InputStream.- Parameters:
dis
- stream to read from, like a FileInputStream- Returns:
- NBT tag or structure read from the InputStream
- Throws:
IOException
- if there was no valid NBT structure in the InputStream or if another IOException occurred.
-
writeTo
Read a tag and its nested tags from an InputStream.- Parameters:
os
- stream to write to, like a FileOutputStream- Throws:
IOException
- if this is not a valid NBT structure or if any IOException occurred.
-
print
public void print()Print the NBT structure to System.out
-