This method decompresses data from a DataInputStream and automatically detects the file format. It only decompresses an image from a DataInputStream and created from a ByteArray. Then, you can call decompress on a ByteArray or create a DataInputStream from this ByteArray.

You can find the samples for using this methodin the \Samples\com\snowbound\samples directory. This method is used in the The Save Page to Memory Sample sample.

Note: You cannot readfrom an InputStream because it does not allow random access to the data. You must use either a string or a DataInputStream that was created from a ByteArray.

Syntax

int IMG_decompress_bitmap(java.io.DataInputStream di, int page);

Example

Example 3.3: IMG_decompress_bitmap Sample

java.io.RandomAccessFile ras; int length;byte buff[];
try{ ras = new java.io.RandomAccessFile (st,"r"); length = (int)ras.length();
buff = new byte[length]; ras.readFully(buff,0,length);
}
catch (IOException ioe)
{
return -2;
}
java.io.DataInputStream di;
di = new java.io.DataInputStream(new java.io.ByteArrayInputStream(buff))
stat = tSimage.IMG_decompress_bitmap(di, page);

Remark

IMG_decompress_bitmap(java.io.DataInputStream, int) method variables:

Variable Description
di Java.io.DataInputStream
page Page number if reading from multi-page image file

Returns

Returns the status of the DataInputStream. A value of 0 indicates success. Any value less than zero is a RasterMaster error code. See RasterMaster Error Codes for a list of error codes.