Package land.oras

Class Layer


@NullMarked public final class Layer extends Descriptor
Class for layer
  • Method Details

    • getData

      public @Nullable String getData()
      Get the data
      Returns:
      The data
    • getBlobPath

      public @Nullable Path getBlobPath()
      Get the blob path
      Returns:
      The blob path
    • withAnnotations

      public Layer withAnnotations(Map<String,String> annotations)
      Create a new layer with annotations
      Parameters:
      annotations - The annotations
      Returns:
      The new layer
    • withMediaType

      public Layer withMediaType(String mediaType)
      Create a new layer with media type
      Parameters:
      mediaType - The media type
      Returns:
      The new layer
    • getDataBytes

      public byte[] getDataBytes()
      Get the data as bytes
      Returns:
      The data as bytes
    • fromJson

      public static Layer fromJson(String json)
      Create a layer from a JSON string
      Parameters:
      json - The JSON string
      Returns:
      The manifest
    • fromFile

      public static Layer fromFile(Path file)
      Create a layer from a file using default digest
      Parameters:
      file - The file
      Returns:
      The layer
    • fromFile

      public static Layer fromFile(Path file, SupportedAlgorithm algorithm)
      Create a layer from a file using a specific algorithm
      Parameters:
      file - The file
      algorithm - The algorithm
      Returns:
      The layer
    • fromData

      public static Layer fromData(ContainerRef containerRef, byte[] data)
      Create a layer from data
      Parameters:
      containerRef - The container reference
      data - The data
      Returns:
      The layer
    • fromDigest

      public static Layer fromDigest(String digest, long size)
      Create a layer from a digest
      Parameters:
      digest - The digest
      size - The size
      Returns:
      The layer
    • empty

      public static Layer empty()
      An empty config
      Returns:
      The empty config