CLASS net/minecraft/class_2507 net/minecraft/nbt/NbtIo COMMENT A set of utility functions for reading, writing, and scanning NBT files. COMMENT Methods that do not require {@link NbtSizeTracker} accept any bytes of data, COMMENT provided that its depth does not exceed {@value NbtSizeTracker#DEFAULT_MAX_DEPTH}. COMMENT COMMENT

When {@linkplain DataOutput#writeUTF writing an invalid string}, methods in COMMENT this class will write an empty string instead of crashing, with the exception of COMMENT {@link #writeUnsafe} which throws instead. FIELD field_47513 OPEN_OPTIONS [Ljava/nio/file/OpenOption; METHOD method_10625 readCompound (Ljava/io/DataInput;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2487; COMMENT Reads an NBT compound from {@code input}. COMMENT COMMENT @return the NBT compound from the input COMMENT @throws IOException if the IO operation fails or if the root NBT element is COMMENT not a compound COMMENT @throws NbtSizeValidationException if the {@code tracker}'s validation fails ARG 0 input ARG 1 tracker METHOD method_10626 readElement (Ljava/io/DataInput;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2520; ARG 0 input ARG 1 tracker METHOD method_10627 readCompound (Ljava/io/DataInput;)Lnet/minecraft/class_2487; COMMENT Reads an NBT compound from {@code input}. COMMENT COMMENT @return the NBT compound from the input COMMENT @throws IOException if the IO operation fails or if the root NBT element is COMMENT not a compound COMMENT @throws NbtSizeValidationException if the NBT is too deep ARG 0 input METHOD method_10628 writeCompound (Lnet/minecraft/class_2487;Ljava/io/DataOutput;)V COMMENT Writes the {@code nbt} to {@code output}. COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @see #write(NbtCompound, Path) ARG 0 nbt ARG 1 output METHOD method_10629 readCompressed (Ljava/io/InputStream;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2487; COMMENT Reads an NBT compound from Gzip-compressed {@code stream}. COMMENT COMMENT @return the NBT compound from the stream COMMENT @throws IOException if the IO operation fails or if the root NBT element is COMMENT not a compound COMMENT @throws NbtSizeValidationException if the NBT is too deep COMMENT @see #readCompressed(Path, NbtSizeTracker) ARG 0 stream ARG 1 tagSizeTracker METHOD method_10630 write (Lnet/minecraft/class_2487;Ljava/nio/file/Path;)V COMMENT Writes the {@code nbt} to the file at {@code path}. COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @see #writeCompound(NbtCompound, DataOutput) ARG 0 nbt ARG 1 path METHOD method_10631 writeUnsafe (Lnet/minecraft/class_2520;Ljava/io/DataOutput;)V COMMENT Writes the {@code nbt} to {@code output}. The output is the byte indicating COMMENT the element type, followed by {@linkplain DataOutput#writeUTF an empty string} COMMENT and the NBT data. COMMENT COMMENT

When {@linkplain DataOutput#writeUTF writing an invalid string}, this COMMENT method will throw an error, unlike other methods. COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @see #read(DataInput, NbtSizeTracker) COMMENT @see #writeForPacket(NbtElement, DataOutput) COMMENT @see #write(NbtElement, DataOutput) ARG 0 nbt ARG 1 output METHOD method_10633 read (Ljava/nio/file/Path;)Lnet/minecraft/class_2487; COMMENT Reads an NBT compound from the file at{@code path}. COMMENT COMMENT @return the NBT compound from the file, or {@code null} if the file does not exist COMMENT @throws IOException if the IO operation fails or if the root NBT element is COMMENT not a compound COMMENT @throws NbtSizeValidationException if the NBT is too deep ARG 0 path METHOD method_10634 writeCompressed (Lnet/minecraft/class_2487;Ljava/io/OutputStream;)V COMMENT Writes the Gzip-compressed {@code nbt} to {@code stream}. COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @see #writeCompressed(NbtCompound, Path) ARG 0 nbt ARG 1 stream METHOD method_30613 readCompressed (Ljava/nio/file/Path;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2487; COMMENT Reads an NBT compound from Gzip-compressed file at {@code path}. COMMENT COMMENT @return the NBT compound from the file COMMENT @throws IOException if the IO operation fails or if the root NBT element is COMMENT not a compound COMMENT @throws NbtSizeValidationException if the NBT is too deep COMMENT @see #readCompressed(InputStream, NbtSizeTracker) ARG 0 path ARG 1 tagSizeTracker METHOD method_30614 writeCompressed (Lnet/minecraft/class_2487;Ljava/nio/file/Path;)V COMMENT Writes the Gzip-compressed {@code nbt} to the file at {@code path}. COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @see #writeCompressed(NbtCompound, OutputStream) ARG 0 nbt ARG 1 path METHOD method_39855 scan (Ljava/io/DataInput;Lnet/minecraft/class_6836;Lnet/minecraft/class_2505;)V COMMENT Scans the NBT input using {@code scanner}. COMMENT COMMENT @apiNote This method does not return the scan result; the user is expected COMMENT to call the appropriate method of the {@link NbtScanner} subclasses, such as COMMENT {@link net.minecraft.nbt.scanner.NbtCollector#getRoot()}. COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @throws NbtSizeValidationException if the {@code tracker}'s validation fails ARG 0 input ARG 1 scanner ARG 2 tracker METHOD method_40057 scanCompressed (Ljava/nio/file/Path;Lnet/minecraft/class_6836;Lnet/minecraft/class_2505;)V COMMENT Scans the compressed NBT file using {@code scanner}. COMMENT COMMENT @apiNote This method does not return the scan result; the user is expected COMMENT to call the appropriate method of the {@link NbtScanner} subclasses, such as COMMENT {@link net.minecraft.nbt.scanner.NbtCollector#getRoot()}. COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @throws NbtSizeValidationException if the {@code tracker}'s validation fails COMMENT @see #scanCompressed(InputStream, NbtScanner, NbtSizeTracker) ARG 0 path ARG 1 scanner ARG 2 tracker METHOD method_40058 scanCompressed (Ljava/io/InputStream;Lnet/minecraft/class_6836;Lnet/minecraft/class_2505;)V COMMENT Scans the compressed NBT stream using {@code scanner}. COMMENT COMMENT @apiNote This method does not return the scan result; the user is expected COMMENT to call the appropriate method of the {@link NbtScanner} subclasses, such as COMMENT {@link net.minecraft.nbt.scanner.NbtCollector#getRoot()}. COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @throws NbtSizeValidationException if the {@code tracker}'s validation fails COMMENT @see #scanCompressed(Path, NbtScanner, NbtSizeTracker) ARG 0 stream ARG 1 scanner ARG 2 tracker METHOD method_40059 decompress (Ljava/io/InputStream;)Ljava/io/DataInputStream; COMMENT {@return a new input stream that decompresses the input {@code stream}} ARG 0 stream METHOD method_52892 readElement (Ljava/io/DataInput;Lnet/minecraft/class_2505;B)Lnet/minecraft/class_2520; ARG 0 input ARG 1 tracker ARG 2 typeId METHOD method_52893 writeForPacket (Lnet/minecraft/class_2520;Ljava/io/DataOutput;)V COMMENT Writes the {@code nbt} to {@code output}. The output is the byte indicating COMMENT the element type, followed by the NBT data. COMMENT COMMENT @apiNote In vanilla, this is used exclusively in networking. COMMENT @throws IOException if the IO operation fails COMMENT @see #read(DataInput, NbtSizeTracker) COMMENT @see #write(NbtElement, DataOutput) ARG 0 nbt ARG 1 output METHOD method_52894 read (Ljava/io/DataInput;Lnet/minecraft/class_2505;)Lnet/minecraft/class_2520; COMMENT Reads an NBT element from {@code input}. Unlike {@link COMMENT #readCompound(DataInput, NbtSizeTracker)}, the element does not have to COMMENT be a compound. COMMENT COMMENT @return the NBT element from the input COMMENT @throws IOException if the IO operation fails COMMENT @throws NbtSizeValidationException if the {@code tracker}'s validation fails ARG 0 input ARG 1 tracker METHOD method_54906 compress (Ljava/io/OutputStream;)Ljava/io/DataOutputStream; COMMENT {@return a new output stream that compresses the input {@code stream}} ARG 0 stream METHOD method_55324 write (Lnet/minecraft/class_2520;Ljava/io/DataOutput;)V COMMENT Writes the {@code nbt} to {@code output}. The output is the byte indicating COMMENT the element type, followed by {@linkplain DataOutput#writeUTF an empty string} COMMENT and the NBT data. COMMENT COMMENT

When {@linkplain DataOutput#writeUTF writing an invalid string}, this COMMENT method will write an empty string instead of crashing. COMMENT COMMENT @throws IOException if the IO operation fails COMMENT @see #read(DataInput, NbtSizeTracker) COMMENT @see #writeForPacket(NbtElement, DataOutput) COMMENT @see #writeUnsafe(NbtElement, DataOutput) ARG 0 nbt ARG 1 output CLASS class_9003 InvalidUtfSkippingDataOutput