visad.data.jai
Class JAIForm

java.lang.Object
  extended by visad.data.FormNode
      extended by visad.data.Form
          extended by visad.data.jai.JAIForm
All Implemented Interfaces:
FormFileInformer

public class JAIForm
extends Form
implements FormFileInformer

JAIForm is the VisAD data form for image formats supported by the Java Advanced Imaging API: BMP, GIF, FlashPix, JPEG, PNG, PNM, and TIFF.


Field Summary
 
Fields inherited from class visad.data.Form
mathType
 
Constructor Summary
JAIForm()
          Constructs a new JAI file form.
 
Method Summary
 void add(String id, Data data, boolean replace)
          Adds data to an existing JAI image file.
 String[] getDefaultSuffixes()
          Returns the default file suffixes for the JAI image file formats.
 FormNode getForms(Data data)
          Return the data forms that are compatible with a data object.
 boolean isThisType(byte[] block)
          Checks if the given block is a valid header for a JAI image file.
 boolean isThisType(String name)
          Checks if the given string is a valid filename for a JAI image file.
static void main(String[] args)
          Run 'java visad.data.visad.JAIForm in_file' to test read an image file supported by Java Advanced Imaging.
 DataImpl open(String id)
          Opens an existing JAI image file from the given location.
 DataImpl open(URL url)
          Opens an existing JAI image file from the given URL.
 void save(String id, Data data, boolean replace)
          Saves a VisAD Data object to a JAI image format at the given location.
 
Methods inherited from class visad.data.Form
getMathType
 
Methods inherited from class visad.data.FormNode
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JAIForm

public JAIForm()
Constructs a new JAI file form.

Method Detail

isThisType

public boolean isThisType(String name)
Checks if the given string is a valid filename for a JAI image file.

Specified by:
isThisType in interface FormFileInformer
Parameters:
name - name of the file
Returns:
true if the name is right for this type of form

isThisType

public boolean isThisType(byte[] block)
Checks if the given block is a valid header for a JAI image file.

Specified by:
isThisType in interface FormFileInformer
Parameters:
block - block of bytes from file
Returns:
true if the magic number is right

getDefaultSuffixes

public String[] getDefaultSuffixes()
Returns the default file suffixes for the JAI image file formats.

Specified by:
getDefaultSuffixes in interface FormFileInformer
Returns:
array of suffixes

save

public void save(String id,
                 Data data,
                 boolean replace)
          throws BadFormException,
                 IOException,
                 RemoteException,
                 VisADException
Saves a VisAD Data object to a JAI image format at the given location.

Specified by:
save in class FormNode
Throws:
BadFormException - Always thrown (method is not implemented).
IOException
RemoteException
VisADException

add

public void add(String id,
                Data data,
                boolean replace)
         throws BadFormException
Adds data to an existing JAI image file.

Specified by:
add in class FormNode
Throws:
BadFormException - Always thrown (method is not implemented).

open

public DataImpl open(String id)
              throws BadFormException,
                     IOException,
                     VisADException
Opens an existing JAI image file from the given location.

Specified by:
open in class FormNode
Returns:
VisAD Data object containing JAI image data.
Throws:
BadFormException
IOException
VisADException

open

public DataImpl open(URL url)
              throws BadFormException,
                     IOException,
                     VisADException
Opens an existing JAI image file from the given URL.

Specified by:
open in class FormNode
Returns:
VisAD Data object containing JAI image data.
Throws:
BadFormException
IOException
VisADException

getForms

public FormNode getForms(Data data)
Description copied from class: FormNode
Return the data forms that are compatible with a data object.

Specified by:
getForms in class FormNode

main

public static void main(String[] args)
                 throws VisADException,
                        RemoteException,
                        IOException
Run 'java visad.data.visad.JAIForm in_file' to test read an image file supported by Java Advanced Imaging.

Throws:
VisADException
RemoteException
IOException