public class JarWriter extends Object implements LoaderClassesWriter
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
JarWriter.EntryTransformer
An
EntryTransformer enables the transformation of jar
entries during the writing process. |
static class |
JarWriter.IdentityEntryTransformer
An
EntryTransformer that returns the entry unchanged. |
| 构造器和说明 |
|---|
JarWriter(File file)
Create a new
JarWriter instance. |
JarWriter(File file,
boolean append)
Create a new
JarWriter instance. |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
Close the writer.
|
void |
writeBootstrapEntry(JarFile containerJar) |
void |
writeEntries(JarFile jarFile)
Write all entries from the specified jar file.
|
void |
writeEntries(JarFile jarFile,
JarWriter.EntryTransformer entryTransformer) |
void |
writeEntry(String entryName,
InputStream inputStream)
Writes an entry.
|
void |
writeLoaderClasses(JarInputStream jarInputStream)
Write classes needed by the cabin launcher to the JAR.
|
void |
writeManifest(Manifest manifest)
Write the specified manifest.
|
void |
writeNestedLibrary(String destination,
Library library)
Write a nested library.
|
public JarWriter(File file) throws IOException
JarWriter instance.file - the file to writeIOException - if the file cannot be openedFileNotFoundException - if the file cannot be foundpublic JarWriter(File file, boolean append) throws IOException
JarWriter instance.file - the file to writeIOException - if the file cannot be openedFileNotFoundException - if the file cannot be foundpublic void writeManifest(Manifest manifest) throws IOException
manifest - the manifest to writeIOException - of the manifest cannot be writtenpublic void writeEntries(JarFile jarFile) throws IOException
jarFile - the source jar fileIOException - if the entries cannot be writtenpublic void writeBootstrapEntry(JarFile containerJar) throws IOException
IOExceptionpublic void writeEntries(JarFile jarFile, JarWriter.EntryTransformer entryTransformer) throws IOException
IOExceptionpublic void writeEntry(String entryName, InputStream inputStream) throws IOException
inputStream is closed once the entry has been writtenwriteEntry 在接口中 LoaderClassesWriterentryName - The name of the entryinputStream - The stream from which the entry's data can be readIOException - if the write failspublic void writeNestedLibrary(String destination, Library library) throws IOException
destination - the destination of the librarylibrary - the libraryIOException - if the write failspublic void writeLoaderClasses(JarInputStream jarInputStream) throws IOException
LoaderClassesWriterwriteLoaderClasses 在接口中 LoaderClassesWriterjarInputStream - the inputStream of the resource containing the loader classes
to be writtenIOException - if the classes cannot be writtenpublic void close()
throws IOException
IOException - if the file cannot be closedCopyright © 2021. All rights reserved.