Class NBTReader


  • public class NBTReader
    extends java.lang.Object
    Class for reading NBT binary data from files.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static byte GZIP  
      static byte UNKNOWN  
      static byte ZLIB  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static NBTCompound read​(byte[] bytes)
      Reads the byte array and returns the root compound tag and its children.
      static NBTCompound read​(byte[] bytes, byte compression)
      Reads the byte array and returns the root compound tag and its children.
      static NBTCompound read​(java.io.File file)
      Reads the file and returns the root compound tag and its children.
      static NBTCompound read​(java.io.File file, byte compression)
      Reads the file and returns the root compound tag and its children.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • read

        public static NBTCompound read​(java.io.File file)
                                throws java.io.IOException
        Reads the file and returns the root compound tag and its children.
        Parameters:
        file - The file to read in as NBT data.
        Returns:
        The root NBT tag.
        Throws:
        java.io.IOException - If the file does not exist or is not NBT data.
      • read

        public static NBTCompound read​(java.io.File file,
                                       byte compression)
                                throws java.io.IOException
        Reads the file and returns the root compound tag and its children.
        Parameters:
        file - The file to read in as NBT data.
        compression - The type of compression that the NBT file uses.
        Returns:
        The root NBT tag.
        Throws:
        java.io.IOException - If the file does not exist or is not NBT data.
      • read

        public static NBTCompound read​(byte[] bytes)
                                throws java.io.IOException
        Reads the byte array and returns the root compound tag and its children.
        Parameters:
        bytes - The byte array to read in as NBT data.
        Returns:
        The root NBT tag.
        Throws:
        java.io.IOException - If the byte array is not NBT data.
      • read

        public static NBTCompound read​(byte[] bytes,
                                       byte compression)
                                throws java.io.IOException
        Reads the byte array and returns the root compound tag and its children.
        Parameters:
        bytes - The byte array to read in as NBT data.
        compression - The type of compression that the NBT byte array uses.
        Returns:
        The root NBT tag.
        Throws:
        java.io.IOException - If the byte array is not NBT data.