Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.pearsoneduc.ip.io
Class SIFEncoder

    java.lang.Object
      |
      +--com.pearsoneduc.ip.io.SIFEncoder

public class SIFEncoder
extends java.lang.Object
implements ImageEncoder, SIFConstants

Writes image data to a stream or file encoded in the SIF format.

SIF files have a very simple binary format. The first four bytes constitute a signature for the file. Valid signatures are listed below:

Signature | Image type
--- | ---
`BIMG` | 8-bit greyscale image
`bIMG` | 8-bit greyscale image, compressed
`CIMG` | 24-bit colour image
`cIMG` | 24-bit colour image, compressed

Following the signature are two binary-formatted integers, representing the width and height of the image. The remainder of a SIF file consists of image data. Colour images are stored in band-interleaved format, i.e. blue, green and red values for each pixel in turn.

Version:
  1.0 [1999/01/30]
Author:
  Nick Efford
See Also:
  `SIFEncoderException`, `SIFDecoder`, `BufferedImage`

Constructor Summary
`SIFEncoder()` Constructs a SIFEncoder associated with the standard output.
`SIFEncoder(java.io.OutputStream stream)` Constructs a SIFEncoder associated with a specified OutputStream.
`SIFEncoder(java.lang.String imgfile)` Constructs a SIFEncoder that writes to a named file.

Method Summary
`boolean` | `compressionEnabled()`
`void` | `disableCompression()` Turns image compression off.
`void` | `enableCompression()` Turns image compression on.
`void` | `encode(java.awt.image.BufferedImage img)` Writes a BufferedImage to a stream in SIF format.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SIFEncoder

    public SIFEncoder()

  Constructs a SIFEncoder associated with the standard output.

### SIFEncoder

    public SIFEncoder(java.io.OutputStream stream)

  Constructs a SIFEncoder associated with a specified OutputStream.
  Parameters:
    `stream` - the stream to which image data will be written

### SIFEncoder

    public SIFEncoder(java.lang.String imgfile)
               throws java.io.FileNotFoundException

  Constructs a SIFEncoder that writes to a named file.
  Parameters:
    `imgfile` - name of the file to which image data will be written
  Throws:
    java.io.FileNotFoundException - if the file could not be accessed.

Method Detail

### compressionEnabled

    public boolean compressionEnabled()

  Returns:
    true if compression will be carried out, false otherwise.

### enableCompression

    public void enableCompression()

  Turns image compression on.

### disableCompression

    public void disableCompression()

  Turns image compression off.

### encode

    public void encode(java.awt.image.BufferedImage img)
                throws java.io.IOException,
                       SIFEncoderException

  Writes a BufferedImage to a stream in SIF format.
  Specified by:
    encode in interface ImageEncoder
  Parameters:
    `img` - The BufferedImage to be written
  Throws:
    java.io.IOException - if bytes could not be written to the stream.
    SIFEncoderException - if the BufferedImage type is not supported by the SIF format.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD