com.lowagie.text

Class Jpeg

public class Jpeg extends Image

An Jpeg is the representation of a graphic element (JPEG) that has to be inserted into the document

See Also: Element Image

Field Summary
static byte[]JFIF_ID
sequence that is used in all Jpeg files
static intM_APP0
Marker value
static intM_APPE
Marker value
static intNOPARAM_MARKER
This is a type of marker.
static int[]NOPARAM_MARKERS
Jpeg markers without additional parameters.
static intNOT_A_MARKER
This is a type of marker.
static intUNSUPPORTED_MARKER
This is a type of marker.
static int[]UNSUPPORTED_MARKERS
Unsupported Jpeg markers.
static intVALID_MARKER
This is a type of marker.
static int[]VALID_MARKERS
Acceptable Jpeg markers.
Constructor Summary
Jpeg(Image image)
Jpeg(URL url)
Constructs a Jpeg-object, using an url.
Jpeg(URL url, float width, float height)
Constructs a Jpeg-object, using an url.
Jpeg(String filename)
Constructs a Jpeg-object, using a filename.
Jpeg(String filename, float width, float height)
Constructs a Jpeg-object, using a filename.
Jpeg(byte[] img)
Constructs a Jpeg-object from memory.
Jpeg(byte[] img, float width, float height)
Constructs a Jpeg-object from memory.
Method Summary
static intgetShort(InputStream is)
Reads a short from the InputStream.
static intmarker(int marker)
Returns a type of marker.
voidprocessParameters()
This method checks if the image is a valid JPEG and processes some parameters.

Field Detail

JFIF_ID

public static final byte[] JFIF_ID
sequence that is used in all Jpeg files

M_APP0

public static final int M_APP0
Marker value

M_APPE

public static final int M_APPE
Marker value

NOPARAM_MARKER

public static final int NOPARAM_MARKER
This is a type of marker.

NOPARAM_MARKERS

public static final int[] NOPARAM_MARKERS
Jpeg markers without additional parameters.

NOT_A_MARKER

public static final int NOT_A_MARKER
This is a type of marker.

UNSUPPORTED_MARKER

public static final int UNSUPPORTED_MARKER
This is a type of marker.

UNSUPPORTED_MARKERS

public static final int[] UNSUPPORTED_MARKERS
Unsupported Jpeg markers.

VALID_MARKER

public static final int VALID_MARKER
This is a type of marker.

VALID_MARKERS

public static final int[] VALID_MARKERS
Acceptable Jpeg markers.

Constructor Detail

Jpeg

Jpeg(Image image)

Jpeg

public Jpeg(URL url)
Constructs a Jpeg-object, using an url.

Parameters: url the URL where the image can be found

Throws: BadElementException IOException

Jpeg

public Jpeg(URL url, float width, float height)

Deprecated: use Image.getInstance(...) to create an Image

Constructs a Jpeg-object, using an url.

Parameters: url the URL where the image can be found. width new width of the Jpeg height new height of the Jpeg

Throws: BadElementException IOException

Jpeg

public Jpeg(String filename)

Deprecated: use Image.getInstance(...) to create an Image

Constructs a Jpeg-object, using a filename.

Parameters: filename a String-representation of the file that contains the Image.

Throws: BadElementException MalformedURLException IOException

Jpeg

public Jpeg(String filename, float width, float height)

Deprecated: use Image.getInstance(...) to create an Image

Constructs a Jpeg-object, using a filename.

Parameters: filename a String-representation of the file that contains the Image. width new width of the Jpeg height new height of the Jpeg

Throws: BadElementException MalformedURLException IOException

Jpeg

public Jpeg(byte[] img)
Constructs a Jpeg-object from memory.

Parameters: img the memory image

Throws: BadElementException IOException

Jpeg

public Jpeg(byte[] img, float width, float height)
Constructs a Jpeg-object from memory.

Parameters: img the memory image. width the width you want the image to have height the height you want the image to have

Throws: BadElementException IOException

Method Detail

getShort

private static final int getShort(InputStream is)
Reads a short from the InputStream.

Parameters: is the InputStream

Returns: an int

Throws: IOException

marker

private static final int marker(int marker)
Returns a type of marker.

Parameters: marker an int

Returns: a type: VALID_MARKER, UNSUPPORTED_MARKER or NOPARAM_MARKER

processParameters

private void processParameters()
This method checks if the image is a valid JPEG and processes some parameters.

Throws: BadElementException IOException