Class LayersIndex

java.lang.Object
org.springframework.boot.loader.tools.LayersIndex

public class LayersIndex extends Object
Index describing the layer to which each entry in a jar belongs. Index files are simple text files that should be read from top to bottom. Each file defines the layers and their content. Layer names are written as quoted strings prefixed by a dash space ("- ") and with a colon (":") suffix. Layer content is either a file or directory name written as a quoted string prefixed by space space dash space (" - "). A directory name ends with /, a file name does not. When a directory name is used it means that all files inside that directory are in the same layer.

Index files are designed to be compatible with YAML and may be read into a list of Map<String, List<String>> instances.

Since:
2.3.0
Author:
Madhura Bhave, Andy Wilkinson, Phillip Webb
  • Constructor Details

    • LayersIndex

      public LayersIndex(Layer... layers)
      Create a new LayersIndex backed by the given layers.
      Parameters:
      layers - the layers in the index
    • LayersIndex

      public LayersIndex(Iterable<Layer> layers)
      Create a new LayersIndex backed by the given layers.
      Parameters:
      layers - the layers in the index
  • Method Details

    • add

      public void add(Layer layer, String name)
      Add an item to the index.
      Parameters:
      layer - the layer of the item
      name - the name of the item
    • writeTo

      public void writeTo(OutputStream out) throws IOException
      Write the layer index to an output stream.
      Parameters:
      out - the destination stream
      Throws:
      IOException - on IO error