Class AbstractJarWriter

java.lang.Object
org.springframework.boot.loader.tools.AbstractJarWriter
All Implemented Interfaces:
LoaderClassesWriter
Direct Known Subclasses:
JarWriter

public abstract class AbstractJarWriter extends Object implements LoaderClassesWriter
Abstract base class for JAR writers.
Since:
2.3.0
Author:
Phillip Webb, Andy Wilkinson, Madhura Bhave
  • Constructor Details

    • AbstractJarWriter

      public AbstractJarWriter()
  • Method Details

    • writeManifest

      public void writeManifest(Manifest manifest) throws IOException
      Write the specified manifest.
      Parameters:
      manifest - the manifest to write
      Throws:
      IOException - of the manifest cannot be written
    • writeEntry

      public void writeEntry(String entryName, InputStream inputStream) throws IOException
      Writes an entry. The inputStream is closed once the entry has been written
      Specified by:
      writeEntry in interface LoaderClassesWriter
      Parameters:
      entryName - the name of the entry
      inputStream - the stream from which the entry's data can be read
      Throws:
      IOException - if the write fails
    • writeEntry

      public void writeEntry(String entryName, EntryWriter entryWriter) throws IOException
      Writes an entry. The inputStream is closed once the entry has been written
      Parameters:
      entryName - the name of the entry
      entryWriter - the entry writer
      Throws:
      IOException - if the write fails
    • writeNestedLibrary

      public void writeNestedLibrary(String location, Library library) throws IOException
      Write a nested library.
      Parameters:
      location - the destination of the library
      library - the library
      Throws:
      IOException - if the write fails
    • writeIndexFile

      public void writeIndexFile(String location, Collection<String> lines) throws IOException
      Write a simple index file containing the specified UTF-8 lines.
      Parameters:
      location - the location of the index file
      lines - the lines to write
      Throws:
      IOException - if the write fails
      Since:
      2.3.0
    • writeLoaderClasses

      public void writeLoaderClasses() throws IOException
      Description copied from interface: LoaderClassesWriter
      Write the default required spring-boot-loader classes to the JAR.
      Specified by:
      writeLoaderClasses in interface LoaderClassesWriter
      Throws:
      IOException - if the classes cannot be written
    • writeLoaderClasses

      public void writeLoaderClasses(LoaderImplementation loaderImplementation) throws IOException
      Description copied from interface: LoaderClassesWriter
      Write the default required spring-boot-loader classes to the JAR.
      Specified by:
      writeLoaderClasses in interface LoaderClassesWriter
      Parameters:
      loaderImplementation - the specific implementation to write
      Throws:
      IOException - if the classes cannot be written
    • writeLoaderClasses

      public void writeLoaderClasses(String loaderJarResourceName) throws IOException
      Write the required spring-boot-loader classes to the JAR.
      Specified by:
      writeLoaderClasses in interface LoaderClassesWriter
      Parameters:
      loaderJarResourceName - the name of the resource containing the loader classes to be written
      Throws:
      IOException - if the classes cannot be written
    • writeToArchive

      protected abstract void writeToArchive(ZipEntry entry, EntryWriter entryWriter) throws IOException
      Throws:
      IOException