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
official aoj
intermediary net/minecraft/class_6397
named net/minecraft/util/ZipCompressor
  • Field Details

    • LOGGER

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

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

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

      private final FileSystem zip
      Mappings:
      Namespace Name Mixin selector
      official d Laoj;d:Ljava/nio/file/FileSystem;
      intermediary field_33867 Lnet/minecraft/class_6397;field_33867:Ljava/nio/file/FileSystem;
      named zip Lnet/minecraft/util/ZipCompressor;zip: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
      official <init> Laoj;<init>(Ljava/nio/file/Path;)V
      intermediary <init> Lnet/minecraft/class_6397;<init>(Ljava/nio/file/Path;)V
      named <init> Lnet/minecraft/util/ZipCompressor;<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
      official a Laoj;a(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
      named write Lnet/minecraft/util/ZipCompressor;write(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
      official a Laoj;a(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
      named copy Lnet/minecraft/util/ZipCompressor;copy(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
      official a Laoj;a(Ljava/nio/file/Path;)V
      intermediary method_37161 Lnet/minecraft/class_6397;method_37161(Ljava/nio/file/Path;)V
      named copyAll Lnet/minecraft/util/ZipCompressor;copyAll(Ljava/nio/file/Path;)V
    • close

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