JavaTM 2 Platform
Std. Ed. v1.3.1

com.apple.mrj
Class MRJFileUtils

java.lang.Object
  |
  +--com.apple.mrj.MRJFileUtils

public class MRJFileUtils
extends Object


Field Summary
static MRJOSType kAppleMenuFolderType
           
static MRJOSType kCachedDataFolderType
           
static MRJOSType kChewableItemsFolderType
           
static MRJOSType kControlPanelFolderType
           
static MRJOSType kDesktopFolderType
           
static MRJOSType kExtensionFolderType
           
static MRJOSType kFontsFolderType
           
static MRJOSType kPreferencesFolderType
           
static MRJOSType kPrintMonitorDocsFolderType
           
static MRJOSType kShutdownFolderType
           
static MRJOSType kStartupFolderType
           
static MRJOSType kSystemFolderType
           
static MRJOSType kTemporaryFolderType
           
static MRJOSType kTrashFolderType
           
static short kUserDomain
          Get the path to a special Macintosh folder.
static MRJOSType kWhereToEmptyTrashFolderType
           
 
Constructor Summary
MRJFileUtils()
           
 
Method Summary
static File findApplication(MRJOSType applSig)
          Deprecated. Not implemented in Mac OS X
static File findFolder(MRJOSType folderType)
           
static File findFolder(short domain, MRJOSType folderType)
           
static File findFolder(short domain, MRJOSType folderType, boolean createIfNeeded)
           
static MRJOSType getFileCreator(File file)
          Returns the creator of a file.
static MRJOSType getFileType(File file)
          Returns the type of a file.
static File getResource(String resourceName)
          Gets specified file from the Resources directory in app bundle Will throw NoSuchMethodError if run on MRJ 2.x VM.
static File getResource(String resourceName, String subDirName)
          Gets specified file from specified sub directory of Resources directory in app bundle Will throw NoSuchMethodError if run on MRJ 2.x VM.
static void openURL(String url)
          Launches the default browser application (if not already running) and tells it to open the specifed URL.
static void setDefaultFileCreator(MRJOSType defaultCreator)
          Deprecated. Not implemented in Mac OS X
static void setDefaultFileType(MRJOSType defaultType)
          Deprecated. Not implemented in Mac OS X
static void setFileCreator(File file, MRJOSType creator)
          Sets the creator of an existing file in the MacOS filesystem.
static boolean setFileLastModified(File file, long aDate)
          Deprecated. use java.io.File.setLastModified
static void setFileType(File file, MRJOSType type)
          Sets the type of an existing file in the MacOS filesystem.
static void setFileTypeAndCreator(File file, MRJOSType type, MRJOSType creator)
          Sets the type and creator of an existing file in the MacOS filesystem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kUserDomain

public static final short kUserDomain
Get the path to a special Macintosh folder. By default the startup volume is used, but you can specify this by setting the domain parameter to any of those specified in Folders.h. kUserDomain is specified here for convenience to mean 'the current user's domain'. Also, if the folder requested does not exist it is not created by default. To override this behavior, use the three-argument version of findFolder, specifying true to create the folder if necessary.

kSystemFolderType

public static final MRJOSType kSystemFolderType

kDesktopFolderType

public static final MRJOSType kDesktopFolderType

kTrashFolderType

public static final MRJOSType kTrashFolderType

kWhereToEmptyTrashFolderType

public static final MRJOSType kWhereToEmptyTrashFolderType

kPrintMonitorDocsFolderType

public static final MRJOSType kPrintMonitorDocsFolderType

kStartupFolderType

public static final MRJOSType kStartupFolderType

kShutdownFolderType

public static final MRJOSType kShutdownFolderType

kAppleMenuFolderType

public static final MRJOSType kAppleMenuFolderType

kControlPanelFolderType

public static final MRJOSType kControlPanelFolderType

kExtensionFolderType

public static final MRJOSType kExtensionFolderType

kFontsFolderType

public static final MRJOSType kFontsFolderType

kPreferencesFolderType

public static final MRJOSType kPreferencesFolderType

kChewableItemsFolderType

public static final MRJOSType kChewableItemsFolderType

kTemporaryFolderType

public static final MRJOSType kTemporaryFolderType

kCachedDataFolderType

public static final MRJOSType kCachedDataFolderType
Constructor Detail

MRJFileUtils

public MRJFileUtils()
Method Detail

setFileLastModified

public static boolean setFileLastModified(File file,
                                          long aDate)
Deprecated. use java.io.File.setLastModified

Sets the modification date of a file.

setDefaultFileType

public static void setDefaultFileType(MRJOSType defaultType)
Deprecated. Not implemented in Mac OS X

Set the default file type and creator for newly created Files. When the runtime starts up, the default file type is 'TEXT' and the default creator is the current application creator.

setDefaultFileCreator

public static void setDefaultFileCreator(MRJOSType defaultCreator)
Deprecated. Not implemented in Mac OS X


setFileTypeAndCreator

public static final void setFileTypeAndCreator(File file,
                                               MRJOSType type,
                                               MRJOSType creator)
                                        throws IOException
Sets the type and creator of an existing file in the MacOS filesystem.

setFileType

public static final void setFileType(File file,
                                     MRJOSType type)
                              throws IOException
Sets the type of an existing file in the MacOS filesystem.

setFileCreator

public static final void setFileCreator(File file,
                                        MRJOSType creator)
                                 throws IOException
Sets the creator of an existing file in the MacOS filesystem.

getFileType

public static final MRJOSType getFileType(File file)
                                   throws IOException
Returns the type of a file.

getFileCreator

public static final MRJOSType getFileCreator(File file)
                                      throws IOException
Returns the creator of a file.

findFolder

public static File findFolder(MRJOSType folderType)
                       throws FileNotFoundException

findFolder

public static File findFolder(short domain,
                              MRJOSType folderType)
                       throws FileNotFoundException

findFolder

public static File findFolder(short domain,
                              MRJOSType folderType,
                              boolean createIfNeeded)
                       throws FileNotFoundException

findApplication

public static File findApplication(MRJOSType applSig)
                            throws FileNotFoundException
Deprecated. Not implemented in Mac OS X

Find an Application on any disk with the given creator. This File can then be passed to Runtime.exec().

openURL

public static void openURL(String url)
                    throws IOException
Launches the default browser application (if not already running) and tells it to open the specifed URL. Will throw NoSuchMethodError if run on pre MRJ 2.2 VM
Since:
MRJ 2.2

getResource

public static File getResource(String resourceName)
                        throws FileNotFoundException
Gets specified file from the Resources directory in app bundle Will throw NoSuchMethodError if run on MRJ 2.x VM.
Parameters:
resourceName - name of the file
Throws:
FileNotFoundException - if the request file does not exist in the app bundle
Since:
Mac OS X

getResource

public static File getResource(String resourceName,
                               String subDirName)
                        throws FileNotFoundException
Gets specified file from specified sub directory of Resources directory in app bundle Will throw NoSuchMethodError if run on MRJ 2.x VM.
Parameters:
resourceName - name of the file
subDirName - name of the sub directory of Resources
Throws:
FileNotFoundException - if the request file does not exist in the app bundle
Since:
Mac OS X

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.