public class JarWriter extends Object implements LoaderClassesWriter
| Modifier and Type | Class and Description |
|---|---|
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. |
| Constructor and Description |
|---|
JarWriter(File file)
Create a new
JarWriter instance. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the writer.
|
void |
writeBootstrapEntry(JarFile arkContainerJar) |
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 custom required SOFA-ark-loader classes to the JAR.
|
void |
writeManifest(Manifest manifest)
Write the specified manifest.
|
void |
writeMarkEntry() |
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 void writeManifest(Manifest manifest) throws IOException
manifest - the manifest to writeIOException - of the manifest cannot be writtenpublic void writeMarkEntry()
throws IOException
IOExceptionpublic void writeEntries(JarFile jarFile) throws IOException
jarFile - the source jar fileIOException - if the entries cannot be writtenpublic void writeBootstrapEntry(JarFile arkContainerJar) 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 in interface 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 in interface LoaderClassesWriterjarInputStream - the inputStream of the resource containing the loader classes
to be writtenIOExceptionpublic void close()
throws IOException
IOException - if the file cannot be closedCopyright © 2024. All rights reserved.