Class NbtIo

java.lang.Object
net.minecraft.nbt.NbtIo

public class NbtIo extends Object
A set of utility functions for reading, writing, and scanning NBT files.
Mappings:
Namespace Name
official qz
intermediary net/minecraft/class_2507
named net/minecraft/nbt/NbtIo
  • Constructor Details

    • NbtIo

      public NbtIo()
  • Method Details

    • readCompressed

      public static NbtCompound readCompressed(File file) throws IOException
      Reads an NBT compound from Gzip-compressed file.
      Returns:
      the NBT compound from the file
      Throws:
      IOException - if the IO operation fails or if the root NBT element is not a compound
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Ljava/io/File;)Lqp;
      intermediary method_30613 Lnet/minecraft/class_2507;method_30613(Ljava/io/File;)Lnet/minecraft/class_2487;
      named readCompressed Lnet/minecraft/nbt/NbtIo;readCompressed(Ljava/io/File;)Lnet/minecraft/nbt/NbtCompound;
    • decompress

      private static DataInputStream decompress(InputStream stream) throws IOException
      Returns a new input stream that decompresses the input stream.
      Returns:
      a new input stream that decompresses the input stream
      Throws:
      IOException
      Mappings:
      Namespace Name Mixin selector
      official b Lqz;b(Ljava/io/InputStream;)Ljava/io/DataInputStream;
      intermediary method_40059 Lnet/minecraft/class_2507;method_40059(Ljava/io/InputStream;)Ljava/io/DataInputStream;
      named decompress Lnet/minecraft/nbt/NbtIo;decompress(Ljava/io/InputStream;)Ljava/io/DataInputStream;
    • readCompressed

      public static NbtCompound readCompressed(InputStream stream) throws IOException
      Reads an NBT compound from Gzip-compressed stream.
      Returns:
      the NBT compound from the stream
      Throws:
      IOException - if the IO operation fails or if the root NBT element is not a compound
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Ljava/io/InputStream;)Lqp;
      intermediary method_10629 Lnet/minecraft/class_2507;method_10629(Ljava/io/InputStream;)Lnet/minecraft/class_2487;
      named readCompressed Lnet/minecraft/nbt/NbtIo;readCompressed(Ljava/io/InputStream;)Lnet/minecraft/nbt/NbtCompound;
    • scanCompressed

      public static void scanCompressed(File file, NbtScanner scanner) throws IOException
      Scans the compressed NBT file using scanner.
      Throws:
      IOException - if the IO operation fails
      See Also:
      API Note:
      This method does not return the scan result; the user is expected to call the appropriate method of the NbtScanner subclasses, such as NbtCollector.getRoot().
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Ljava/io/File;Lrf;)V
      intermediary method_40057 Lnet/minecraft/class_2507;method_40057(Ljava/io/File;Lnet/minecraft/class_6836;)V
      named scanCompressed Lnet/minecraft/nbt/NbtIo;scanCompressed(Ljava/io/File;Lnet/minecraft/nbt/scanner/NbtScanner;)V
    • scanCompressed

      public static void scanCompressed(InputStream stream, NbtScanner scanner) throws IOException
      Scans the compressed NBT stream using scanner.
      Throws:
      IOException - if the IO operation fails
      See Also:
      API Note:
      This method does not return the scan result; the user is expected to call the appropriate method of the NbtScanner subclasses, such as NbtCollector.getRoot().
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Ljava/io/InputStream;Lrf;)V
      intermediary method_40058 Lnet/minecraft/class_2507;method_40058(Ljava/io/InputStream;Lnet/minecraft/class_6836;)V
      named scanCompressed Lnet/minecraft/nbt/NbtIo;scanCompressed(Ljava/io/InputStream;Lnet/minecraft/nbt/scanner/NbtScanner;)V
    • writeCompressed

      public static void writeCompressed(NbtCompound nbt, File file) throws IOException
      Writes the Gzip-compressed nbt to file.
      Throws:
      IOException - if the IO operation fails
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Lqp;Ljava/io/File;)V
      intermediary method_30614 Lnet/minecraft/class_2507;method_30614(Lnet/minecraft/class_2487;Ljava/io/File;)V
      named writeCompressed Lnet/minecraft/nbt/NbtIo;writeCompressed(Lnet/minecraft/nbt/NbtCompound;Ljava/io/File;)V
    • writeCompressed

      public static void writeCompressed(NbtCompound nbt, OutputStream stream) throws IOException
      Writes the Gzip-compressed nbt to stream.
      Throws:
      IOException - if the IO operation fails
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Lqp;Ljava/io/OutputStream;)V
      intermediary method_10634 Lnet/minecraft/class_2507;method_10634(Lnet/minecraft/class_2487;Ljava/io/OutputStream;)V
      named writeCompressed Lnet/minecraft/nbt/NbtIo;writeCompressed(Lnet/minecraft/nbt/NbtCompound;Ljava/io/OutputStream;)V
    • write

      public static void write(NbtCompound nbt, File file) throws IOException
      Writes the nbt to file.
      Throws:
      IOException - if the IO operation fails
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lqz;b(Lqp;Ljava/io/File;)V
      intermediary method_10630 Lnet/minecraft/class_2507;method_10630(Lnet/minecraft/class_2487;Ljava/io/File;)V
      named write Lnet/minecraft/nbt/NbtIo;write(Lnet/minecraft/nbt/NbtCompound;Ljava/io/File;)V
    • read

      @Nullable public static @Nullable NbtCompound read(File file) throws IOException
      Reads an NBT compound from file.
      Returns:
      the NBT compound from the file, or null if the file does not exist
      Throws:
      IOException - if the IO operation fails or if the root NBT element is not a compound
      Mappings:
      Namespace Name Mixin selector
      official b Lqz;b(Ljava/io/File;)Lqp;
      intermediary method_10633 Lnet/minecraft/class_2507;method_10633(Ljava/io/File;)Lnet/minecraft/class_2487;
      named read Lnet/minecraft/nbt/NbtIo;read(Ljava/io/File;)Lnet/minecraft/nbt/NbtCompound;
    • read

      public static NbtCompound read(DataInput input) throws IOException
      Reads an NBT compound from input.
      Returns:
      the NBT compound from the input
      Throws:
      IOException - if the IO operation fails or if the root NBT element is not a compound
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Ljava/io/DataInput;)Lqp;
      intermediary method_10627 Lnet/minecraft/class_2507;method_10627(Ljava/io/DataInput;)Lnet/minecraft/class_2487;
      named read Lnet/minecraft/nbt/NbtIo;read(Ljava/io/DataInput;)Lnet/minecraft/nbt/NbtCompound;
    • read

      public static NbtCompound read(DataInput input, NbtTagSizeTracker tracker) throws IOException
      Reads an NBT compound from input.
      Returns:
      the NBT compound from the input
      Throws:
      IOException - if the IO operation fails or if the root NBT element is not a compound
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Ljava/io/DataInput;Lqy;)Lqp;
      intermediary method_10625 Lnet/minecraft/class_2507;method_10625(Ljava/io/DataInput;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2487;
      named read Lnet/minecraft/nbt/NbtIo;read(Ljava/io/DataInput;Lnet/minecraft/nbt/NbtTagSizeTracker;)Lnet/minecraft/nbt/NbtCompound;
    • write

      public static void write(NbtCompound nbt, DataOutput output) throws IOException
      Writes the nbt to file.
      Throws:
      IOException - if the IO operation fails
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Lqp;Ljava/io/DataOutput;)V
      intermediary method_10628 Lnet/minecraft/class_2507;method_10628(Lnet/minecraft/class_2487;Ljava/io/DataOutput;)V
      named write Lnet/minecraft/nbt/NbtIo;write(Lnet/minecraft/nbt/NbtCompound;Ljava/io/DataOutput;)V
    • scan

      public static void scan(DataInput input, NbtScanner scanner) throws IOException
      Scans the NBT input using scanner.
      Throws:
      IOException - if the IO operation fails
      API Note:
      This method does not return the scan result; the user is expected to call the appropriate method of the NbtScanner subclasses, such as NbtCollector.getRoot().
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Ljava/io/DataInput;Lrf;)V
      intermediary method_39855 Lnet/minecraft/class_2507;method_39855(Ljava/io/DataInput;Lnet/minecraft/class_6836;)V
      named scan Lnet/minecraft/nbt/NbtIo;scan(Ljava/io/DataInput;Lnet/minecraft/nbt/scanner/NbtScanner;)V
    • write

      public static void write(NbtElement nbt, DataOutput output) throws IOException
      Throws:
      IOException
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Lri;Ljava/io/DataOutput;)V
      intermediary method_10631 Lnet/minecraft/class_2507;method_10631(Lnet/minecraft/class_2520;Ljava/io/DataOutput;)V
      named write Lnet/minecraft/nbt/NbtIo;write(Lnet/minecraft/nbt/NbtElement;Ljava/io/DataOutput;)V
    • read

      private static NbtElement read(DataInput input, int depth, NbtTagSizeTracker tracker) throws IOException
      Throws:
      IOException
      Mappings:
      Namespace Name Mixin selector
      official a Lqz;a(Ljava/io/DataInput;ILqy;)Lri;
      intermediary method_10626 Lnet/minecraft/class_2507;method_10626(Ljava/io/DataInput;ILnet/minecraft/class_2505;)Lnet/minecraft/class_2520;
      named read Lnet/minecraft/nbt/NbtIo;read(Ljava/io/DataInput;ILnet/minecraft/nbt/NbtTagSizeTracker;)Lnet/minecraft/nbt/NbtElement;