类 JarWriter
- java.lang.Object
-
- io.esastack.cabin.tools.JarWriter
-
- 所有已实现的接口:
LoaderClassesWriter,Closeable,AutoCloseable
public class JarWriter extends Object implements LoaderClassesWriter, Closeable
Writes JAR content, ensuring valid directory entries are always create and duplicate- 作者:
- Phillip Webb, Andy Wilkinson
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static interfaceJarWriter.EntryTransformerAnEntryTransformerenables the transformation ofjar entriesduring the writing process.static classJarWriter.IdentityEntryTransformerAnEntryTransformerthat returns the entry unchanged.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclose()Close the writer.voidwriteBootstrapEntry(JarFile containerJar)voidwriteEntries(JarFile jarFile)Write all entries from the specified jar file.voidwriteEntries(JarFile jarFile, JarWriter.EntryTransformer entryTransformer)voidwriteEntry(String entryName, InputStream inputStream)Writes an entry.voidwriteLoaderClasses(JarInputStream jarInputStream)Write classes needed by the cabin launcher to the JAR.voidwriteManifest(Manifest manifest)Write the specified manifest.voidwriteNestedLibrary(String destination, Library library)Write a nested library.
-
-
-
构造器详细资料
-
JarWriter
public JarWriter(File file) throws IOException
Create a newJarWriterinstance.- 参数:
file- the file to write- 抛出:
IOException- if the file cannot be openedFileNotFoundException- if the file cannot be found
-
JarWriter
public JarWriter(File file, boolean append) throws IOException
Create a newJarWriterinstance.- 参数:
file- the file to write- 抛出:
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
-
writeBootstrapEntry
public void writeBootstrapEntry(JarFile containerJar) throws IOException
- 抛出:
IOException
-
writeEntries
public void writeEntries(JarFile jarFile, JarWriter.EntryTransformer entryTransformer) throws IOException
- 抛出:
IOException
-
writeEntry
public void writeEntry(String entryName, InputStream inputStream) throws IOException
Writes an entry. TheinputStreamis 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(JarInputStream jarInputStream) throws IOException
从接口复制的说明:LoaderClassesWriterWrite classes needed by the cabin launcher to the JAR.- 指定者:
writeLoaderClasses在接口中LoaderClassesWriter- 参数:
jarInputStream- the inputStream of the resource containing the loader classes to be written- 抛出:
IOException- if the classes cannot be written
-
close
public void close() throws IOExceptionClose the writer.- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable- 抛出:
IOException- if the file cannot be closed
-
-