Class JarWriter
java.lang.Object
org.springframework.boot.loader.tools.AbstractJarWriter
org.springframework.boot.loader.tools.JarWriter
- All Implemented Interfaces:
AutoCloseable,LoaderClassesWriter
Writes JAR content, ensuring valid directory entries are always created and duplicate
items are ignored.
- Since:
- 1.0.0
- Author:
- Phillip Webb, Andy Wilkinson, Madhura Bhave, Scott Frederick
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the writer.protected voidwriteToArchive(ZipEntry entry, EntryWriter entryWriter) Methods inherited from class org.springframework.boot.loader.tools.AbstractJarWriter
writeEntry, writeEntry, writeIndexFile, writeLoaderClasses, writeLoaderClasses, writeLoaderClasses, writeManifest, writeNestedLibrary
-
Constructor Details
-
JarWriter
Create a newJarWriterinstance.- Parameters:
file- the file to write- Throws:
IOException- if the file cannot be openedFileNotFoundException- if the file cannot be found
-
JarWriter
Create a newJarWriterinstance.- Parameters:
file- the file to writelaunchScript- an optional launch script to prepend to the front of the jar- Throws:
IOException- if the file cannot be openedFileNotFoundException- if the file cannot be found
-
JarWriter
public JarWriter(File file, LaunchScript launchScript, FileTime lastModifiedTime) throws FileNotFoundException, IOException Create a newJarWriterinstance.- Parameters:
file- the file to writelaunchScript- an optional launch script to prepend to the front of the jarlastModifiedTime- an optional last modified time to apply to the written entries- Throws:
IOException- if the file cannot be openedFileNotFoundException- if the file cannot be found- Since:
- 2.3.0
-
-
Method Details
-
writeToArchive
- Specified by:
writeToArchivein classAbstractJarWriter- Throws:
IOException
-
close
Close the writer.- Specified by:
closein interfaceAutoCloseable- Throws:
IOException- if the file cannot be closed
-