public class MacStuff extends Object
com.apple.eio.FileManager.| Modifier and Type | Method and Description |
|---|---|
static boolean |
fileHasType(File file,
String type)
Returns
true if a file has the given file type. |
static boolean |
isMacintosh()
Determines if we're running on a Macintosh, so appropriate UI
adjustments can be made.
|
public static boolean isMacintosh()
mrj.version property
rather than checking the os.name property.public static boolean fileHasType(File file, String type) throws ClassNotFoundException
true if a file has the given file type.
This method uses FileManager in a dynamic way, so
that it will merely throw a ClassNotFound exception
if it fails.
Currently this code isn't actually used, since the Jhove application is specified as checking only internal signatures. Should some future version or add-on code wish to use it, the code should look something like this:
try {
if (sig.getType() == SignatureType.FILETYPE &&
MacStuff.isMacintosh()) {
if (!MacStuff.fileHasType(file, sig.getValueString())) {
info.setConsistent(false);
}
}
}
catch (ClassNotFoundException cnfe) {
// Mac classes missing -- can't check filetype.
}
ClassNotFoundExceptionCopyright © 2008–2021 The Open Preservation Foundation. All rights reserved.