# Class ImageEncoder

java.lang.Object
javajs.img.ImageEncoder

All Implemented Interfaces:
  `GenericImageEncoder`

Direct Known Subclasses:
  `GifEncoder, JpgEncoder, PdfEncoder, PngEncoder, PpmEncoder`

public abstract class ImageEncoder extends Object implements GenericImageEncoder
Generic abstract image creator: (1) set parameters (2) encode the image bytes, if necessary (3) generate the image

Author:
  Bob Hanson hansonr@stolaf.edu

## Field Summary

Fields
Modifier and Type
Field
Description
`protected String`
`date`
`protected boolean`
`doClose`
`protected int`
`dpi`
`protected int`
`height`
`protected boolean`
`logging`
`protected OC`
`out`
`protected int[]`
`pixels`
`protected int`
`quality`
`protected int`
`width`

## Constructor Summary

Constructors
Constructor
Description
`ImageEncoder()`

## Method Summary

Modifier and Type
Method
Description
`protected void`
`close()`
`boolean`
`createImage(String type, OC out, Map<String,Object> params)`
`protected abstract void`
`generate()`
`protected void`
`putByte(int b)`
`protected void`
`putString(String s)`
`protected abstract void`
`setParams(Map<String,Object> params)`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### out

protected OC out

### width

protected int width

### height

protected int height

### quality

protected int quality

### dpi

protected int dpi

### date

protected String date

### logging

protected boolean logging

### doClose

protected boolean doClose

### pixels

protected int[] pixels

## Constructor Details

### ImageEncoder

public ImageEncoder()

## Method Details

### createImage

public boolean createImage(String type, OC out, Map<String,Object> params) throws Exception

Specified by:
  `createImage` in interface `GenericImageEncoder`
Parameters:
  `type` -
  `out` -
  `params` -
Throws:
  `Exception`

### setParams

protected abstract void setParams(Map<String,Object> params)

### generate

protected abstract void generate() throws Exception

Throws:
  `Exception`

### putString

protected void putString(String s)

### putByte

protected void putByte(int b)

### close

protected void close()