Record Class ZipResult

java.lang.Object
java.lang.Record
cloud.opencode.base.io.compress.ZipResult
Record Components:
zipFile - path to the ZIP file involved | 涉及的 ZIP 文件路径
entryCount - number of entries processed | 处理的条目数
originalSize - total uncompressed bytes | 原始未压缩总字节数
compressedSize - total compressed bytes — for compress this is the size of the resulting ZIP on disk; for extract this is the sum of ZipEntry.getCompressedSize() across processed entries. Note: when extract reads via ZipFile the central-directory value is reliable, but entries lacking a compressedSize header field contribute 0 to the sum. | 压缩后总字节数 — compress 时为磁盘 ZIP 大小;extract 时为各条目 ZipEntry.getCompressedSize() 之和。当中央目录 字段缺失时该条目贡献 0
compressionRatio - 1.0 - compressed/original, in [0.0, 1.0] when sensible | 1.0 - 压缩 / 原始,在合理时位于 [0.0, 1.0] 区间
elapsed - wall-clock duration of the operation | 操作墙钟耗时
entries - immutable list of entry names processed; passing null is permitted and is normalised to List.of() in the canonical constructor. Never null on the accessor. | 处理的条目名(不可变列表);构造时允许传 null,规范构造器会 归一化为 List.of();访问器永不返回 null

public record ZipResult(Path zipFile, int entryCount, long originalSize, long compressedSize, double compressionRatio, Duration elapsed, List<String> entries) extends Record
Aggregated outcome of a ZIP compress or extract operation. ZIP 压缩或解压操作的汇总结果。

Captures sizing, timing and entry-name metadata so callers can record metrics or present compression-ratio summaries.

记录大小、耗时与条目名等元信息,便于调用方上报指标或展示压缩率摘要。

Since:
JDK 25, opencode-base-io V1.0.4
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • ZipResult

      public ZipResult(Path zipFile, int entryCount, long originalSize, long compressedSize, double compressionRatio, Duration elapsed, List<String> entries)
      Canonical constructor — defensively copies entries so the returned record is fully immutable. 规范构造器,对 entries 做防御性拷贝以保证记录完全不可变。
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • zipFile

      public Path zipFile()
      Returns the value of the zipFile record component.
      Returns:
      the value of the zipFile record component
    • entryCount

      public int entryCount()
      Returns the value of the entryCount record component.
      Returns:
      the value of the entryCount record component
    • originalSize

      public long originalSize()
      Returns the value of the originalSize record component.
      Returns:
      the value of the originalSize record component
    • compressedSize

      public long compressedSize()
      Returns the value of the compressedSize record component.
      Returns:
      the value of the compressedSize record component
    • compressionRatio

      public double compressionRatio()
      Returns the value of the compressionRatio record component.
      Returns:
      the value of the compressionRatio record component
    • elapsed

      public Duration elapsed()
      Returns the value of the elapsed record component.
      Returns:
      the value of the elapsed record component
    • entries

      public List<String> entries()
      Returns the value of the entries record component.
      Returns:
      the value of the entries record component