MacStuff (JHOVE Documentation)
Date: 2013-09-08

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.harvard.hul.ois.jhove
Class MacStuff

    java.lang.Object
      edu.harvard.hul.ois.jhove.MacStuff

    public class MacStuff

extends java.lang.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 package com.apple.eio.FileManager.

Author:
  Gary McGath

Method Summary
`static boolean` | `fileHasType(java.io.File file, java.lang.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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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 the mrj.version property rather than checking the os.name property.

### fileHasType

    public static boolean fileHasType(java.io.File file,
                                      java.lang.String type)
                               throws java.lang.ClassNotFoundException

  Returns 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 e) {
                     // Mac classes missing -- can't check filetype.
                 }

  `

  Throws:
    `java.lang.ClassNotFoundException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD