com.sodius.mdw.core.model.diagram
Class DiagramFileImage

java.lang.Object
  extended by com.sodius.mdw.core.model.diagram.DiagramFileImage
All Implemented Interfaces:
DiagramImage
Direct Known Subclasses:
DiagramTemporaryImage

public class DiagramFileImage
extends Object
implements DiagramImage

A file-based diagram image implementation.

Clients may instantiate or subclass this class.

Since:
2.1.0

Field Summary
 
Fields inherited from interface com.sodius.mdw.core.model.diagram.DiagramImage
UNKNOWN_SIZE
 
Constructor Summary
DiagramFileImage(File file)
          Creates a new diagram image based on the specified file.
 
Method Summary
 void dispose()
          This implementation does nothing.
 File getFile()
          Returns the image file.
 int getHeight()
          Returns the height of the image.
 int getWidth()
          Returns the width of the image.
 InputStream openStream()
          Opens a InputStream to read image bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagramFileImage

public DiagramFileImage(File file)
Creates a new diagram image based on the specified file.

This constructor will try to determine the width and height of this image. Supported image formats are: bmp, emf, gif, jpg, png, and wmf.

Parameters:
file - the image file.
Method Detail

getFile

public final File getFile()
Returns the image file.

Returns:
the image file.

openStream

public InputStream openStream()
                       throws IOException
Description copied from interface: DiagramImage
Opens a InputStream to read image bytes.

Specified by:
openStream in interface DiagramImage
Returns:
a stream to read image bytes.
Throws:
IOException - if the image contents is not accessible.

getWidth

public int getWidth()
Description copied from interface: DiagramImage
Returns the width of the image.

Specified by:
getWidth in interface DiagramImage
Returns:
the width of the image (UNKNOWN_SIZE if unknown).

getHeight

public int getHeight()
Description copied from interface: DiagramImage
Returns the height of the image.

Specified by:
getHeight in interface DiagramImage
Returns:
the height of the image (UNKNOWN_SIZE if unknown).

dispose

public void dispose()
This implementation does nothing. Suclasses may override.

Specified by:
dispose in interface DiagramImage