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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the writer.protected void
writeToArchive
(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 newJarWriter
instance.- Parameters:
file
- the file to write- Throws:
IOException
- if the file cannot be openedFileNotFoundException
- if the file cannot be found
-
JarWriter
Create a newJarWriter
instance.- 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 newJarWriter
instance.- 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:
writeToArchive
in classAbstractJarWriter
- Throws:
IOException
-
close
Close the writer.- Specified by:
close
in interfaceAutoCloseable
- Throws:
IOException
- if the file cannot be closed
-