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 differencesIOException
MalformedURLException
protected 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 inputFile
FileNotFoundException
IOException
protected 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 inputFile
FileNotFoundException
IOException
public static ByteCodeAnalyzer analyzeByteCode(InputStream in, boolean closeStream) throws IOException
IOException
protected File javap(File jarFile, String className) throws IOException
javap
on a class file.jarFile
- the .jar file containing the classclassName
- the name of the classIOException
protected void javap(File file) throws IOException
javap
on a class file.file
- the .class file (and the output file)IOException
protected static float getClassVersion(File file) throws IOException
file
- the .class fileIOException
protected static float getClassVersion(InputStream stream) throws IOException
stream
- the InputStream
representing the .class fileIOException
protected 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 contentsIOException
protected static boolean isLocal(URL url)
url
- the URLprotected static long offsetOfFirstDiff(File file1, File file2) throws IOException
file1
- the one filefile2
- the other fileIOException
protected 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 readingIOException
Copyright © 2014–2022 ImageJ. All rights reserved.