quicktime.app
Class QTFactory

java.lang.Object
  |
  +--quicktime.app.QTFactory

public final class QTFactory
extends java.lang.Object

The QTFactory class provides factory methods for creating classes that are used to present media that QuickTime can import. It also provides some utility methods for finding directories and files in the local file system.

An example usage of some of the factory methods:

File mediaFile = QTFactory.findAbsolutePath ("media/myMovie.mov");	
QTDrawable d = QTFactory.makeDrawable(new QTFile(mediaFile));
myQTCanvas.setClient (d);
...
// from an URL
QTDrawable d2 = QTFactory.makeDrawable ("http://web.mywebsite.com/movies/myMovie.mov");
myOtherQTCanvas.setClient (d2);
 


Method Summary
static void addDirectory(java.io.File dir)
          This method will add a directory to the internal list of directories that are searched in the find methods.
static java.io.File findAbsolutePath(java.lang.String fileName)
          Given a filename this method will exhaustively search all paths found in the user.dir and the classPath and will return a file object that contains an absolute path to the specified argument.
static java.io.File findInSystemPaths(java.lang.String fileName)
          This method will take apart the path specification of the fileName and return the first instance of the file (the last name in the path) that it finds within the directories that are known to Java at runtime.
static QTDrawable makeDrawable(java.io.InputStream is, int hintType, java.lang.String hintString)
          This returns a QTDrawable object from the specified input stream.
static QTDrawable makeDrawable(java.io.InputStream is, int hintType, java.lang.String hintString, QTDrawableMaker maker)
          This returns a QTDrawable object from the specified input stream.
static QTDrawable makeDrawable(QTFile qtFile)
          This returns a QTDrawable object from the specified file.
static QTDrawable makeDrawable(QTFile qtFile, QTDrawableMaker maker)
          This returns a QTDrawable object from the specified file.
static QTDrawable makeDrawable(java.lang.String url)
          This returns a QTDrawable object from the specified URL.
static QTDrawable makeDrawable(java.lang.String url, QTDrawableMaker maker)
          This returns a QTDrawable object from the specified Universal Resource Locator.
static void removeDirectory(java.io.File dir)
          This method will remove a directory from the internal list of directories that are searched in the find methods.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findInSystemPaths

public static java.io.File findInSystemPaths(java.lang.String fileName)
                                      throws java.io.IOException
This method will take apart the path specification of the fileName and return the first instance of the file (the last name in the path) that it finds within the directories that are known to Java at runtime.
Parameters:
path - a path specification that should be found somewhere in the system paths
Throws:
java.lang.SecurityException - will be returned if the Applet is not allowed access to the class path system property. Typically this is the case - you should use the codeBase or documentBase paths of the applet to position and locate files at run time.
java.io.IOException - the file cannot be found in any of the class path locations.

addDirectory

public static void addDirectory(java.io.File dir)
                         throws java.io.IOException
This method will add a directory to the internal list of directories that are searched in the find methods. The incoming File object must specify a directory that exists or an IOException will be thrown. If the directory is already a member of the list it will not be added. Directories that are added explicitly will be searched first in the find calls.
Parameters:
dir - a directory

removeDirectory

public static void removeDirectory(java.io.File dir)
                            throws java.io.IOException
This method will remove a directory from the internal list of directories that are searched in the find methods.
Parameters:
dir - a directory

findAbsolutePath

public static java.io.File findAbsolutePath(java.lang.String fileName)
                                     throws java.io.IOException
Given a filename this method will exhaustively search all paths found in the user.dir and the classPath and will return a file object that contains an absolute path to the specified argument.
Parameters:
fileName - the file to search for.
Returns:
a file object that represents the absolute path to the specified path.
Throws:
java.lang.SecurityException - will be returned if the Applet is not allowed access to the class path system property. Typically this is the case - you should use the codeBase or documentBase paths of the applet to position and locate files at run time.
java.io.IOException - the file cannot be found in any of the class path locations.

makeDrawable

public static QTDrawable makeDrawable(QTFile qtFile)
                               throws java.io.IOException,
                                      QTException
This returns a QTDrawable object from the specified file. The file must specify an absolute path. It uses the default QTDrawableMaker to return an GraphicsImporterDrawer object from a GraphicsImporter and a QTPlayer from a Movie.
Parameters:
file - the file to make a movie out of
Returns:
a drawable object that can present the QT File
Throws:
StdQTException - If the file is of a format that is not understood by QuickTime the function will throw a StdQTException with error code invalidMovie.
java.io.IOException - is thrown if the file would violate security settings of an applet
See Also:
GraphicsImporterDrawer, QTPlayer, QTDrawableMaker

makeDrawable

public static QTDrawable makeDrawable(QTFile qtFile,
                                      QTDrawableMaker maker)
                               throws java.io.IOException,
                                      QTException
This returns a QTDrawable object from the specified file. The file must specify an absolute path. It uses the supplied QTDrawableMaker to return objects from a GraphicsImporter or a Movie.
Parameters:
file - the file to make a movie out of
maker - specifies which type of QTDrawable object is returned when the factory imports a Graphics or Movie based media.
Returns:
a drawable object that can present the QT File
Throws:
StdQTException - If the file is of a format that is not understood by QuickTime the function will throw a StdQTException with error code invalidMovie.
java.io.IOException - if the file is not found
See Also:
GraphicsImporterDrawer, QTPlayer, QTDrawableMaker

makeDrawable

public static QTDrawable makeDrawable(java.io.InputStream is,
                                      int hintType,
                                      java.lang.String hintString)
                               throws java.io.IOException,
                                      QTException
This returns a QTDrawable object from the specified input stream. The input stream will be read in its entirety to a byte array which is then used as the source of the data to import. The hints are used by the importers to determine the format of the data contained within the input stream. Hints must be given to QuickTime about the format of the data that is contained within the InputStream. Hints can take one of three forms The preferred usage is to pass in either the MacOS File Type (which will also work on non-MacOS platforms) or the MIME type information. The File extension is a more arbitrary indicator and should be the least referred to. It uses the default QTDrawableMaker to return objects from a GraphicsImporter or a Movie.
Parameters:
is - the input stream from which the bytes will be read
hintFlag - describes the hint data that is used
hintString - contains the hint information
Returns:
a drawable object that can present the QT File
Throws:
StdQTException - If the data is of a format that is not understood by QuickTime the function will throw a StdQTException with error code invalidMovie.
java.io.IOException - is thrown if the input stream is unable to aquire all the data
See Also:
GraphicsImporterDrawer, QTPlayer, QTDrawableMaker

makeDrawable

public static QTDrawable makeDrawable(java.io.InputStream is,
                                      int hintType,
                                      java.lang.String hintString,
                                      QTDrawableMaker maker)
                               throws java.io.IOException,
                                      QTException
This returns a QTDrawable object from the specified input stream. The input stream will be read in its entirety to a byte array which is then used as the source of the data to import. The hints are used by the importers to determine the format of the data contained within the input stream. Hints must be given to QuickTime about the format of the data that is contained within the InputStream. Hints can take one of three forms The preferred usage is to pass in either the MacOS File Type (which will also work on non-MacOS platforms) or the MIME type information. The File extension is a more arbitrary indicator and should be the least referred to. It uses the default QTDrawableMaker to return objects from a GraphicsImporter or a Movie.
Parameters:
hintFlag - describes the hint data that is used
hintString - contains the hint information
maker - specifies which type of QTDrawable object is returned when the factory imports a Graphics or Movie based media.
Returns:
a drawable object that can present the QT File
Throws:
StdQTException - If the data is of a format that is not understood by QuickTime the function will throw a StdQTException with error code invalidMovie.
java.io.IOException - is thrown if the input stream is unable to aquire all the data
See Also:
GraphicsImporterDrawer, QTPlayer, QTDrawableMaker

makeDrawable

public static QTDrawable makeDrawable(java.lang.String url)
                               throws QTException
This returns a QTDrawable object from the specified URL. It uses the default QTDrawableMaker to return an GraphicsImporterDrawer from a GraphicsImporter or a QTPlayer from a Movie.
Parameters:
url - specifies the URL to the QT source media
Returns:
a drawable object that can present a QT media
Throws:
StdQTException - If the file is of a format that is not understood by QuickTime the function will throw a StdQTException with error code invalidMovie.
java.lang.SecurityException - is thrown if the file would violate security settings of an applet

makeDrawable

public static QTDrawable makeDrawable(java.lang.String url,
                                      QTDrawableMaker maker)
                               throws QTException
This returns a QTDrawable object from the specified Universal Resource Locator. It uses the supplied QTDrawableMaker to return objects from a GraphicsImporter or a Movie.
Parameters:
url - is the fully qualified url to the QuickTime media.
maker - specifies which type of QTDrawable object is returned when the factory imports a Graphics or Movie based media.
Returns:
a drawable object that can present the QT File
Throws:
StdQTException - If the file is of a format that is not understood by QuickTime the function will throw a StdQTException with error code invalidMovie.
java.lang.SecurityException - is thrown if the file would violate security settings of an applet
See Also:
GraphicsImporterDrawer, QTPlayer, QTDrawableMaker