Class Decompiler.Builder
- Enclosing class:
Decompiler
-
Method Summary
Modifier and TypeMethodDescriptionbuild(@Nullable OutputSink resourceSink, OutputSink outputSink) Finish configuring the Decompilation operation, and return the Decompiler for use.voiddiscard()Discard all resources retained by the builder without building a Decompiler.Set the reference JRE to the current running JVM.Set the input path to decompile.Set the inputResolverto decompile.setJreReference(Iterable<? extends Resolver> resolvers) Set the reference JRE to the given resolvers.setJreReference(Path jreReference) Set the reference JRE to the given java executable or home path.setListener(DecompilerListener listener) Set the listener for decompiler events.setThreads(int threads) Specify the number of threads to use whilst decompiling.withReferenceLibraries(Iterable<? extends Resolver> resolvers) Add all the givenResolvers as additional reference libraries.withReferencePaths(Iterable<Path> libraries) Add all the given paths as additional reference libraries.withReferencePaths(Path... libraries) Add all the given paths as additional reference libraries.Configure any decompiler settings.
-
Method Details
-
setCurrentJvmReference
Set the reference JRE to the current running JVM.It is usually recommended that you specify an explicit JRE for the exact target your input was compiled with for best results.
Will discard and close any previously set jre reference resolvers.
- Returns:
- The same builder.
-
setJreReference
Set the reference JRE to the given java executable or home path.Will discard and close any previously set jre reference resolvers.
- Parameters:
jreReference- The reference path.- Returns:
- The same builder.
-
setJreReference
public Decompiler.Builder setJreReference(@WillCloseWhenClosed Iterable<? extends Resolver> resolvers) Set the reference JRE to the given resolvers.Will discard and close any previously set jre reference resolvers.
Takes resource ownership of the supplied
Resolverinstances, these will be closed ondiscard()or viaDecompiler.close().- Parameters:
resolvers- The resolvers.- Returns:
- The same builder.
-
withReferencePaths
Add all the given paths as additional reference libraries.- Parameters:
libraries- The libraries.- Returns:
- The same builder.
-
withReferencePaths
Add all the given paths as additional reference libraries.- Parameters:
libraries- The libraries.- Returns:
- The same builder.
-
withReferenceLibraries
public Decompiler.Builder withReferenceLibraries(@WillCloseWhenClosed Iterable<? extends Resolver> resolvers) Add all the givenResolvers as additional reference libraries.Takes resource ownership of the supplied
Resolverinstances, these will be closed ondiscard()or viaDecompiler.close().- Parameters:
resolvers- The resolvers to add.- Returns:
- The same builder.
-
setInput
Set the input path to decompile.- Parameters:
input- The input.- Returns:
- The same builder.
-
setInput
Set the inputResolverto decompile.Takes resource ownership of the supplied
Resolverinstance, it will be closed ondiscard()or viaDecompiler.close().- Parameters:
input- The input.- Returns:
- The same builder.
-
withSettings
Configure any decompiler settings.- Parameters:
cons- The configuration action.- Returns:
- The same builder.
-
setThreads
Specify the number of threads to use whilst decompiling.If not specified defaults to the number of available cores minus one.
- Parameters:
threads- The number of threads to use.- Returns:
- The same builder.
-
setListener
Set the listener for decompiler events.- Parameters:
listener- The listener.- Returns:
- The same builder.
-
build
Finish configuring the Decompilation operation, and return the Decompiler for use.- Parameters:
resourceSink- TheOutputSinkto place resource files into.outputSink- TheOutputSinkto place decompilation results into.- Returns:
- The configured decompiler.
-
discard
Discard all resources retained by the builder without building a Decompiler.- Throws:
IOException
-