Package edu.harvard.hul.ois.jhove
Class MacStuff
- java.lang.Object
-
- edu.harvard.hul.ois.jhove.MacStuff
-
public class MacStuff extends Object
Code specific to Macintosh Java. This class consists of static methods, and should not be instantiated. Its methods should be called only on the Macintosh OS X platform. It requires the packagecom.apple.eio.FileManager.- Author:
- Gary McGath
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanfileHasType(File file, String type)Returnstrueif a file has the given file type.static booleanisMacintosh()Determines if we're running on a Macintosh, so appropriate UI adjustments can be made.
-
-
-
Method Detail
-
isMacintosh
public static boolean isMacintosh()
Determines if we're running on a Macintosh, so appropriate UI adjustments can be made. In accordance with Apple's recommendations, this checks for the existence of themrj.versionproperty rather than checking theos.nameproperty.
-
fileHasType
public static boolean fileHasType(File file, String type) throws ClassNotFoundException
Returnstrueif a file has the given file type. This method usesFileManagerin a dynamic way, so that it will merely throw aClassNotFoundexception 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. }- Throws:
ClassNotFoundException
-
-