Class ArchiveUtils

java.lang.Object
land.oras.utils.ArchiveUtils

@NullMarked public final class ArchiveUtils extends Object
Archive utilities
  • Method Details

    • createTempTar

      public static Path createTempTar()
      Create a temporary archive when uploading directory layers
      Returns:
      The path to the archive
    • tar

      public static LocalPath tar(LocalPath sourceDir)
      Create a tar.gz file from a directory
      Parameters:
      sourceDir - The source directory
      Returns:
      The path to the tar.gz file
    • untar

      public static void untar(InputStream fis, Path target)
      Extract a tar file to a target directory
      Parameters:
      fis - The archive stream
      target - The target directory
    • compress

      public static LocalPath compress(LocalPath path, String mediaType)
      Compress a tar file to a tar.gz or tar.zstd file depending on the requested media type
      Parameters:
      path - The tar file
      mediaType - The target media type
      Returns:
      The path to the tar.gz file or the tar.zstd file
    • uncompress

      public static LocalPath uncompress(InputStream is, String mediaType)
      Extract a compressed file from a tar.gz or tar.zstd file depending on the requested media type
      Parameters:
      is - The compressed input stream
      mediaType - The media type of the stream to select the uncompression method
      Returns:
      The path to the tar.gz file or the tar.zstd file