public abstract class ImgWriter extends Object
Each object inheriting from this class should have a source ImgData object associated with it. The image data to write to the file is obtained from the associated ImgData object. In general this object would be specified at construction time.
Depending on the actual type of file that is written a call to any write() or writeAll() method will write data from one component, several components or all components. For example, a PGM writer will write data from only one component (defined in the constructor) while a PPM writer will write 3 components (normally R,G,B).
| Modifier and Type | Field and Description |
|---|---|
static int |
DEF_STRIP_HEIGHT
The defaukt height used when writing strip by strip in the 'write()'
method.
|
protected int |
h
The height of the image
|
protected BlkImgDataSrc |
src
The source ImagaData object, from where to get the image data
|
protected int |
w
The width of the image
|
| Constructor and Description |
|---|
ImgWriter() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
close()
Closes the underlying file or netwrok connection to where the data is
written.
|
void |
finalize()
Flushes the buffered data before the object is garbage collected.
|
abstract void |
flush()
Writes all buffered data to the file or resource.
|
abstract void |
write()
Writes the source's current tile to the output.
|
abstract void |
write(int ulx,
int uly,
int w,
int h)
Writes the data of the specified area to the file, coordinates are
relative to the current tile of the source.
|
void |
writeAll()
Writes the entire image or only specified tiles to the output.
|
public static final int DEF_STRIP_HEIGHT
protected BlkImgDataSrc src
protected int w
protected int h
public abstract void close()
throws IOException
IOException - If an I/O error occurs.public abstract void flush()
throws IOException
IOException - If an I/O error occurs.public void finalize()
throws IOException
finalize in class ObjectIOException - If an I/O error occurs. It halts the
finalization of the object, but is otherwise ignored.Object.finalize()public abstract void write()
throws IOException
The implementing class should only write data that is not "progressive" (in other words that it is final), see DataBlk for details.
IOException - If an I/O error occurs.DataBlkpublic void writeAll()
throws IOException
IOException - If an I/O error occurs.DataBlkpublic abstract void write(int ulx,
int uly,
int w,
int h)
throws IOException
The implementing class should only write data that is not "progressive" (in other words that is final), see DataBlk for details.
ulx - The horizontal coordinate of the upper-left corner of the
area to write, relative to the current tile.uly - The vertical coordinate of the upper-left corner of the area
to write, relative to the current tile.width - The width of the area to write.height - The height of the area to write.IOException - If an I/O error occurs.Copyright © 2015. All rights reserved.