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 PNGEncoder

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

public class PNGEncoder
extends java.lang.Object
implements ImageEncoder

Writes image data to a stream or a file encoded in the PNG format. This class is merely a wrapper for PNGDataEncoder from the `com.visualtek.PNG` package.

Example of use:

         BufferedImage image =
          new BufferedImage(128, 128, BufferedImage.TYPE_BYTE_GRAY);
         ...
         PNGEncoder png = new PNGEncoder("test.png");
         png.encode(image);

Version:
  1.1 [1999/06/27]
Author:
  Nick Efford
See Also:
  `BufferedImage`

Constructor Summary
`PNGEncoder()` Constructs a PNGEncoder associated with standard output.
`PNGEncoder(java.io.OutputStream out)` Constructs a PNGEncoder that writes to an existing OutputStream object.
`PNGEncoder(java.lang.String filename)` Constructs a PPMEncoder that writes to a named file.

Method Summary
`void` | `encode(java.awt.image.BufferedImage image)` Encodes the specified image in the PNG image format.

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

Constructor Detail

### PNGEncoder

    public PNGEncoder()

  Constructs a PNGEncoder associated with standard output.

### PNGEncoder

    public PNGEncoder(java.io.OutputStream out)

  Constructs a PNGEncoder that writes to an existing OutputStream object.
  Parameters:
    `out` - the destination for the image data

### PNGEncoder

    public PNGEncoder(java.lang.String filename)
               throws java.io.IOException

  Constructs a PPMEncoder that writes to a named file.
  Parameters:
    `filename` - Name of the file to which image data will be written
  Throws:
    java.io.IOException - if the file could not be accessed.

Method Detail

### encode

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

  Encodes the specified image in the PNG image format.
  Specified by:
    encode in interface ImageEncoder
  Parameters:
    `image` - the image to be encoded
  Throws:
    java.io.IOException - if data could not be written to the stream.
    PNGEncoderException - if the image could not be written in PNG format.
  See Also:
    `BufferedImage`

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