Class AbstractJarWriter
java.lang.Object
org.springframework.boot.loader.tools.AbstractJarWriter
- All Implemented Interfaces:
LoaderClassesWriter
- Direct Known Subclasses:
JarWriter
Abstract base class for JAR writers.
- Since:
- 2.3.0
- Author:
- Phillip Webb, Andy Wilkinson, Madhura Bhave
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
writeEntry
(String entryName, InputStream inputStream) Writes an entry.void
writeEntry
(String entryName, EntryWriter entryWriter) Writes an entry.void
writeIndexFile
(String location, Collection<String> lines) Write a simple index file containing the specified UTF-8 lines.void
Write the required spring-boot-loader classes to the JAR.void
writeLoaderClasses
(String loaderJarResourceName) Write the required spring-boot-loader classes to the JAR.void
writeManifest
(Manifest manifest) Write the specified manifest.void
writeNestedLibrary
(String location, Library library) Write a nested library.protected abstract void
writeToArchive
(ZipEntry entry, EntryWriter entryWriter)
-
Constructor Details
-
AbstractJarWriter
public AbstractJarWriter()
-
-
Method Details
-
writeManifest
Write the specified manifest.- Parameters:
manifest
- the manifest to write- Throws:
IOException
- of the manifest cannot be written
-
writeEntry
Writes an entry. TheinputStream
is closed once the entry has been written- Specified by:
writeEntry
in interfaceLoaderClassesWriter
- Parameters:
entryName
- the name of the entryinputStream
- the stream from which the entry's data can be read- Throws:
IOException
- if the write fails
-
writeEntry
Writes an entry. TheinputStream
is closed once the entry has been written- Parameters:
entryName
- the name of the entryentryWriter
- the entry writer- Throws:
IOException
- if the write fails
-
writeNestedLibrary
Write a nested library.- Parameters:
location
- the destination of the librarylibrary
- the library- Throws:
IOException
- if the write fails
-
writeIndexFile
Write a simple index file containing the specified UTF-8 lines.- Parameters:
location
- the location of the index filelines
- the lines to write- Throws:
IOException
- if the write fails- Since:
- 2.3.0
-
writeLoaderClasses
Write the required spring-boot-loader classes to the JAR.- Specified by:
writeLoaderClasses
in interfaceLoaderClassesWriter
- Throws:
IOException
- if the classes cannot be written
-
writeLoaderClasses
Write the required spring-boot-loader classes to the JAR.- Specified by:
writeLoaderClasses
in interfaceLoaderClassesWriter
- Parameters:
loaderJarResourceName
- the name of the resource containing the loader classes to be written- Throws:
IOException
- if the classes cannot be written
-
writeToArchive
- Throws:
IOException
-