org.jfree.pixie.wmf
Class MfHeader

java.lang.Object
  extended byorg.jfree.pixie.wmf.Buffer
      extended byorg.jfree.pixie.wmf.MfHeader

public class MfHeader
extends Buffer

A buffer which represents a Metafile header.


Field Summary
static int QUALITY_MAYBE
          A constant stating that the given file could be a Wmf-File.
static int QUALITY_NO
          A constant stating that the given file is not Wmf-File at all.
static int QUALITY_YES
          A constant stating that the given file is a Wmf-File.
 
Fields inherited from class org.jfree.pixie.wmf.Buffer
bytes
 
Constructor Summary
MfHeader()
           
 
Method Summary
 java.awt.Rectangle getBBox()
          Return the bounding box of this metafile.
 int getFileSize()
          Gets the file size of the WmfFile.
 int getHeaderSize()
          Gets the header size.
 int getMaxRecordSize()
          Gets the size of the largest Record.
 int getObjectsSize()
          Gets the number of records stored in this metafile.
 int getUnitsPerInch()
          Gets the defined resolution, if this is an Aldus-File, null otherwise.
static int isMetafile(java.lang.String inName, java.io.InputStream in)
          Is the given input a metafile?
 boolean isValid()
          Returns true if it looks like a real metafile.
 void read(java.io.InputStream in)
          Read the header from the given input.
 
Methods inherited from class org.jfree.pixie.wmf.Buffer
getByte, getInputStream, getInt, getLength, getShort, getString, read, setByte, setCapacity, setInt, setLength, setShort, setString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUALITY_NO

public static final int QUALITY_NO
A constant stating that the given file is not Wmf-File at all.

See Also:
Constant Field Values

QUALITY_MAYBE

public static final int QUALITY_MAYBE
A constant stating that the given file could be a Wmf-File.

See Also:
Constant Field Values

QUALITY_YES

public static final int QUALITY_YES
A constant stating that the given file is a Wmf-File.

See Also:
Constant Field Values
Constructor Detail

MfHeader

public MfHeader()
Method Detail

isMetafile

public static int isMetafile(java.lang.String inName,
                             java.io.InputStream in)
Is the given input a metafile? We have to guess by reading the header and/or by looking at the file name.

Returns:
either QUALITY_NO, QUALITY_MAYBE or QUALITY_YES.

read

public void read(java.io.InputStream in)
          throws java.io.IOException
Read the header from the given input.

Parameters:
in - the input stream
Throws:
java.io.IOException - if an error occured.

isValid

public boolean isValid()
Returns true if it looks like a real metafile. This implementation does not support Memory-WmfFiles.

Returns:
true, if this file is valid, false otherwise.

getBBox

public java.awt.Rectangle getBBox()
Return the bounding box of this metafile. This returns an empty (0,0,0,0) rectangle if this file is not placeable.

Returns:
the bounding box of the metafile.

getUnitsPerInch

public int getUnitsPerInch()
Gets the defined resolution, if this is an Aldus-File, null otherwise.

Returns:
the image resolution or 0 if not defined.

getFileSize

public int getFileSize()
Gets the file size of the WmfFile.

Returns:
the filesize in bytes.

getObjectsSize

public int getObjectsSize()
Gets the number of records stored in this metafile.

Returns:
the number of records.

getMaxRecordSize

public int getMaxRecordSize()
Gets the size of the largest Record.

Returns:
the maximum record size.

getHeaderSize

public int getHeaderSize()
Gets the header size.

Returns:
the header size.