public class Diff extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Diff.Mode |
| Constructor and Description |
|---|
Diff(PrintStream out)
Deprecated.
|
Diff(PrintStream out,
UpdaterUtil util)
Construct a Diff object.
|
| Modifier and Type | Method and Description |
|---|---|
static ByteCodeAnalyzer |
analyzeByteCode(InputStream in,
boolean closeStream)
Analyze the byte code of a class file.
|
protected static void |
analyzeByteCode(InputStream in,
File outputFile)
Inspect the byte code of a class file.
|
protected File |
cacheFile(URL url,
boolean evenLocal)
Cache a file locally.
|
protected static void |
copy(InputStream in,
OutputStream out,
boolean closeIn,
boolean closeOut)
Copy bytes from an
InputStream to an OutputStream. |
protected static float |
getClassVersion(File file)
Get the version of a class file.
|
protected static float |
getClassVersion(InputStream stream)
Get the version of a class file.
|
protected static List<JarEntry> |
getSortedEntries(JarFile jar)
Make an alphabetically-sorted list of files inside a .jar file.
|
protected void |
hexdump(File inputFile,
File outputFile)
Make a hex-dump.
|
protected static boolean |
isLocal(URL url)
Determine whether a URL refers to a local file.
|
protected void |
javap(File file)
Run
javap on a class file. |
protected File |
javap(File jarFile,
String className)
Run
javap on a class file. |
protected static long |
offsetOfFirstDiff(File file1,
File file2)
Determine whether two files' contents differ.
|
void |
showDiff(String name,
URL remote,
URL local,
Diff.Mode mode)
Show the differences between
remote and local versions of
a file. |
@Deprecated public Diff(PrintStream out)
out - this is where the output goespublic Diff(PrintStream out, UpdaterUtil util)
out - this is where the output goesutil - an instance of UpdaterUtil to access URLspublic void showDiff(String name, URL remote, URL local, Diff.Mode mode) throws IOException, MalformedURLException
remote and local versions of
a file.name - the file nameremote - the URL to the remote versionlocal - the URL to the local versionmode - how to print the differencesIOExceptionMalformedURLExceptionprotected static List<JarEntry> getSortedEntries(JarFile jar)
jar - the .jar fileprotected void hexdump(File inputFile, File outputFile) throws FileNotFoundException, IOException
hex-dump program.inputFile - the file to hex-dumpoutputFile - the output file (can be the same as the inputFileFileNotFoundExceptionIOExceptionprotected static void analyzeByteCode(InputStream in, File outputFile) throws FileNotFoundException, IOException
in - the input stream to analyzeoutputFile - the output file (can be the same as the inputFileFileNotFoundExceptionIOExceptionpublic static ByteCodeAnalyzer analyzeByteCode(InputStream in, boolean closeStream) throws IOException
IOExceptionprotected File javap(File jarFile, String className) throws IOException
javap on a class file.jarFile - the .jar file containing the classclassName - the name of the classIOExceptionprotected void javap(File file) throws IOException
javap on a class file.file - the .class file (and the output file)IOExceptionprotected static float getClassVersion(File file) throws IOException
file - the .class fileIOExceptionprotected static float getClassVersion(InputStream stream) throws IOException
stream - the InputStream representing the .class fileIOExceptionprotected File cacheFile(URL url, boolean evenLocal) throws IOException
url - the URL of the file to cacheevenLocal - force "caching" even local files, e.g. to transform the files
without destroying the original contentsIOExceptionprotected static boolean isLocal(URL url)
url - the URLprotected static long offsetOfFirstDiff(File file1, File file2) throws IOException
file1 - the one filefile2 - the other fileIOExceptionprotected static void copy(InputStream in, OutputStream out, boolean closeIn, boolean closeOut) throws IOException
InputStream to an OutputStream.in - the inputout - the outputcloseIn - whether to close in after readingcloseOut - whether to close out after readingIOExceptionCopyright © 2014–2022 ImageJ. All rights reserved.