public class UpdaterUtil extends Object
net.imagej.updater
package and
subpackages.
Class functionality:
Modifier and Type | Field and Description |
---|---|
protected DropboxURLMapper |
dropboxURLMapper |
static char[] |
hex |
String[] |
launchers |
static String |
macPrefix |
static String |
MAIN_URL |
String |
platform |
String[] |
platforms |
static String |
PREFS_USER |
static String |
SSH_HOST |
static String |
UPDATE_DIRECTORY |
protected Set<String> |
updateablePlatforms |
static String |
XML_COMPRESSED |
Constructor and Description |
---|
UpdaterUtil(File imagejRoot) |
Modifier and Type | Method and Description |
---|---|
static boolean |
canExecute(File file) |
static long |
currentTimestamp() |
static MessageDigest |
getDigest() |
static String |
getDigest(String path,
File file) |
static String |
getJarDigest(File file) |
static String |
getJarDigest(File file,
boolean treatPropertiesSpecially,
boolean treatManifestsSpecially) |
static String |
getJarDigest(File file,
boolean treatPropertiesSpecially,
boolean treatManifestsSpecially,
boolean keepOnlyMainClassInManifest) |
static long |
getLastModified(String url)
Deprecated.
|
long |
getLastModified(URL url) |
static LogService |
getLogService()
Get a log service.
|
static List<String> |
getObsoleteDigests(String path,
File file)
Handle previous methods to calculate the checksums gracefully Earlier, we
simply checksummed all the contents in .jar files.
|
static String |
getPlatform() |
static long |
getTimestamp(File file) |
boolean |
isLauncher(String filename) |
boolean |
isMacOSX() |
static boolean |
isProtectedLocation(File ijRoot)
Determines whether the ImageJ root directory is in an area protected by the OS.
|
boolean |
isUpdateablePlatform(String platform) |
static <T> Iterable<T> |
iterate(Enumeration<T> en) |
static <T> String |
join(String delimiter,
Iterable<T> list) |
URLConnection |
openConnection(URL url)
Open a connection to a
URL . |
InputStream |
openStream(URL url)
Open a stream to a
URL . |
static boolean |
patchInfoPList(File infoPList,
String executable) |
static String |
platformForLauncher(String fileName) |
static String |
prettyPrintTimestamp(long timestamp) |
protected static String |
readFile(File file) |
static byte[] |
readStreamAsBytes(InputStream input) |
void |
setUpdateablePlatforms(String... platforms) |
static String |
stripPrefix(String string,
String prefix) |
static String |
stripSuffix(String string,
String suffix) |
static String |
timestamp(Calendar date) |
static String |
timestamp(long millis) |
static long |
timestamp2millis(long timestamp) |
static long |
timestamp2millis(String timestamp) |
static String |
toCamelCase(String string)
CamelCases a
String . |
static String |
toHex(byte[] bytes) |
static void |
updateDigest(InputStream input,
MessageDigest digest) |
static void |
useSystemProxies() |
protected static void |
writeFile(File file,
String contents) |
public static String MAIN_URL
public static String UPDATE_DIRECTORY
public static String SSH_HOST
public static final String XML_COMPRESSED
public static final String PREFS_USER
public static final String macPrefix
public final String platform
public final String[] platforms
public final String[] launchers
protected final DropboxURLMapper dropboxURLMapper
public static final char[] hex
public UpdaterUtil(File imagejRoot)
public static String getPlatform()
public static String getDigest(String path, File file) throws NoSuchAlgorithmException, FileNotFoundException, IOException, UnsupportedEncodingException
public static MessageDigest getDigest() throws NoSuchAlgorithmException
NoSuchAlgorithmException
public static List<String> getObsoleteDigests(String path, File file) throws FileNotFoundException, IOException
path
- the path relative to the ImageJ directoryfile
- the fileIOException
FileNotFoundException
public static void updateDigest(InputStream input, MessageDigest digest) throws IOException
IOException
public static String toHex(byte[] bytes)
public static String getJarDigest(File file) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public static String getJarDigest(File file, boolean treatPropertiesSpecially, boolean treatManifestsSpecially) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public static String getJarDigest(File file, boolean treatPropertiesSpecially, boolean treatManifestsSpecially, boolean keepOnlyMainClassInManifest) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public static long currentTimestamp()
public static long getTimestamp(File file)
public static String timestamp(long millis)
public static long timestamp2millis(long timestamp)
public static long timestamp2millis(String timestamp)
public static String prettyPrintTimestamp(long timestamp)
public boolean isLauncher(String filename)
public boolean isUpdateablePlatform(String platform)
public void setUpdateablePlatforms(String... platforms)
public boolean isMacOSX()
public static void useSystemProxies()
@Deprecated public static long getLastModified(String url)
public long getLastModified(URL url)
public InputStream openStream(URL url) throws IOException
URL
.
... possibly mapping Dropbox URLs.url
- the URL to openIOException
public URLConnection openConnection(URL url) throws IOException
URL
.
... possibly mapping Dropbox URLs.url
- the URL to openIOException
public static byte[] readStreamAsBytes(InputStream input) throws IOException
IOException
protected static String readFile(File file) throws IOException
IOException
protected static void writeFile(File file, String contents) throws IOException
IOException
public static boolean canExecute(File file)
public static boolean isProtectedLocation(File ijRoot)
On Windows Vista and later, C:\Program Files is a protected location.
ijRoot
- the root directory to testpublic static boolean patchInfoPList(File infoPList, String executable) throws IOException
IOException
public static <T> Iterable<T> iterate(Enumeration<T> en)
public static LogService getLogService()
StderrLogService
cannot be found).Copyright © 2014–2022 ImageJ. All rights reserved.