类 JarWriter
- java.lang.Object
- org.springframework.boot.loader.tools.JarWriter
- 所有已实现的接口:
LoaderClassesWriter
public class JarWriter extends Object implements LoaderClassesWriter
Writes JAR content, ensuring valid directory entries are always create and duplicate items are ignored.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
close()
Close the writer.void
writeEntries(JarFile jarFile)
Write all entries from the specified jar file.void
writeEntry(String entryName, InputStream inputStream)
Writes an entry.void
writeLoaderClasses()
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 destination, Library library)
Write a nested library.
构造器详细资料
JarWriter
public JarWriter(File file) throws FileNotFoundException, IOException
Create a newJarWriter
instance.- 参数:
file
- the file to write- 抛出:
IOException
- if the file cannot be openedFileNotFoundException
- if the file cannot be found
JarWriter
public JarWriter(File file, LaunchScript launchScript) throws FileNotFoundException, IOException
Create a newJarWriter
instance.- 参数:
file
- the file to writelaunchScript
- an optional launch script to prepend to the front of the jar- 抛出:
IOException
- if the file cannot be openedFileNotFoundException
- if the file cannot be found
方法详细资料
writeManifest
public void writeManifest(Manifest manifest) throws IOException
Write the specified manifest.- 参数:
manifest
- the manifest to write- 抛出:
IOException
- of the manifest cannot be written
writeEntries
public void writeEntries(JarFile jarFile) throws IOException
Write all entries from the specified jar file.- 参数:
jarFile
- the source jar file- 抛出:
IOException
- if the entries cannot be written
writeEntry
public void writeEntry(String entryName, InputStream inputStream) throws IOException
Writes an entry. TheinputStream
is closed once the entry has been written- 指定者:
writeEntry
在接口中LoaderClassesWriter
- 参数:
entryName
- The name of the entryinputStream
- The stream from which the entry's data can be read- 抛出:
IOException
- if the write fails
writeNestedLibrary
public void writeNestedLibrary(String destination, Library library) throws IOException
Write a nested library.- 参数:
destination
- the destination of the librarylibrary
- the library- 抛出:
IOException
- if the write fails
writeLoaderClasses
public void writeLoaderClasses() throws IOException
Write the required spring-boot-loader classes to the JAR.- 指定者:
writeLoaderClasses
在接口中LoaderClassesWriter
- 抛出:
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.- 指定者:
writeLoaderClasses
在接口中LoaderClassesWriter
- 参数:
loaderJarResourceName
- the name of the resource containing the loader classes to be written- 抛出:
IOException
- if the classes cannot be written
close
public void close() throws IOException
Close the writer.- 抛出:
IOException
- if the file cannot be closed