Class ZipCompressor

java.lang.Object
net.minecraft.util.ZipCompressor
All Implemented Interfaces:
Closeable, AutoCloseable

public class ZipCompressor extends Object implements Closeable
A ZIP compressor builds up a ZIP file. It completes the ZIP file when it is closed. All its methods and constructors throw UncheckedIOException when an I/O error occurs.
Implementation Requirements:
The compressor writes the contents of the ZIP to a temp file first; then, it replaces the desired file with the temp file when closed.
Mappings:
Namespace Name
named net/minecraft/util/ZipCompressor
intermediary net/minecraft/class_6397
official ayk
  • Field Details

    • LOGGER

      private static final Logger LOGGER
      Mappings:
      Namespace Name Mixin selector
      named LOGGER Lnet/minecraft/util/ZipCompressor;LOGGER:Lorg/slf4j/Logger;
      intermediary field_33864 Lnet/minecraft/class_6397;field_33864:Lorg/slf4j/Logger;
      official a Layk;a:Lorg/slf4j/Logger;
    • file

      private final Path file
      Mappings:
      Namespace Name Mixin selector
      named file Lnet/minecraft/util/ZipCompressor;file:Ljava/nio/file/Path;
      intermediary field_33865 Lnet/minecraft/class_6397;field_33865:Ljava/nio/file/Path;
      official b Layk;b:Ljava/nio/file/Path;
    • temp

      private final Path temp
      Mappings:
      Namespace Name Mixin selector
      named temp Lnet/minecraft/util/ZipCompressor;temp:Ljava/nio/file/Path;
      intermediary field_33866 Lnet/minecraft/class_6397;field_33866:Ljava/nio/file/Path;
      official c Layk;c:Ljava/nio/file/Path;
    • zip

      private final FileSystem zip
      Mappings:
      Namespace Name Mixin selector
      named zip Lnet/minecraft/util/ZipCompressor;zip:Ljava/nio/file/FileSystem;
      intermediary field_33867 Lnet/minecraft/class_6397;field_33867:Ljava/nio/file/FileSystem;
      official d Layk;d:Ljava/nio/file/FileSystem;
  • Constructor Details

    • ZipCompressor

      public ZipCompressor(Path file)
      Creates a ZIP compressor.
      Parameters:
      file - the path of the ZIP file
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/util/ZipCompressor;<init>(Ljava/nio/file/Path;)V
      intermediary <init> Lnet/minecraft/class_6397;<init>(Ljava/nio/file/Path;)V
      official <init> Layk;<init>(Ljava/nio/file/Path;)V
  • Method Details

    • write

      public void write(Path target, String content)
      Writes the content, in UTF-8 encoding, to the target path within the ZIP.

      The target should be a relative path, as it will be resolved against the root of the ZIP.

      Parameters:
      target - the target path in the ZIP
      content - the file content to write in UTF-8
      Mappings:
      Namespace Name Mixin selector
      named write Lnet/minecraft/util/ZipCompressor;write(Ljava/nio/file/Path;Ljava/lang/String;)V
      intermediary method_37163 Lnet/minecraft/class_6397;method_37163(Ljava/nio/file/Path;Ljava/lang/String;)V
      official a Layk;a(Ljava/nio/file/Path;Ljava/lang/String;)V
    • copy

      public void copy(Path target, File source)
      Copies a source file to the target path within the ZIP.

      If the source is a directory, then an empty directory would be copied. The target should be a relative path, as it will be resolved against the root of the ZIP.

      Parameters:
      target - the target path in the ZIP
      source - the source file to copy
      Mappings:
      Namespace Name Mixin selector
      named copy Lnet/minecraft/util/ZipCompressor;copy(Ljava/nio/file/Path;Ljava/io/File;)V
      intermediary method_37162 Lnet/minecraft/class_6397;method_37162(Ljava/nio/file/Path;Ljava/io/File;)V
      official a Layk;a(Ljava/nio/file/Path;Ljava/io/File;)V
    • copyAll

      public void copyAll(Path source)
      Copies the source file or directory to the root of the ZIP.
      Parameters:
      source - the source file or directory to copy
      Mappings:
      Namespace Name Mixin selector
      named copyAll Lnet/minecraft/util/ZipCompressor;copyAll(Ljava/nio/file/Path;)V
      intermediary method_37161 Lnet/minecraft/class_6397;method_37161(Ljava/nio/file/Path;)V
      official a Layk;a(Ljava/nio/file/Path;)V
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable