java.lang.Object
org.springframework.boot.buildpack.platform.docker.type.Layer
All Implemented Interfaces:
Content

public class Layer extends Object implements Content
A layer that can be written to an ImageArchive.
Since:
2.3.0
Author:
Phillip Webb
  • Method Details

    • getId

      public LayerId getId()
      Return the ID of the layer.
      Returns:
      the layer ID
    • size

      public int size()
      Description copied from interface: Content
      The size of the content in bytes.
      Specified by:
      size in interface Content
      Returns:
      the content size
    • writeTo

      public void writeTo(OutputStream outputStream) throws IOException
      Description copied from interface: Content
      Write the content to the given output stream.
      Specified by:
      writeTo in interface Content
      Parameters:
      outputStream - the output stream to write to
      Throws:
      IOException - on IO error
    • of

      public static Layer of(IOConsumer<Layout> layout) throws IOException
      Factory method to create a new Layer with a specific Layout.
      Parameters:
      layout - the layer layout
      Returns:
      a new layer instance
      Throws:
      IOException - on IO error
    • fromTarArchive

      public static Layer fromTarArchive(TarArchive tarArchive) throws IOException
      Factory method to create a new Layer from a TarArchive.
      Parameters:
      tarArchive - the contents of the layer
      Returns:
      a new layer instance
      Throws:
      IOException - on error