public abstract class TIFFCompressor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
compressionTagValue
The value to be assigned to the TIFF Compression tag in the
TIFF image metadata.
|
protected java.lang.String |
compressionType
The name of the compression type supported by this compressor.
|
protected boolean |
isCompressionLossless
Whether the compression is lossless.
|
protected javax.imageio.metadata.IIOMetadata |
metadata
The
IIOMetadata object containing metadata for the
current image. |
protected javax.imageio.stream.ImageOutputStream |
stream
The
ImageOutputStream to be written. |
protected javax.imageio.ImageWriter |
writer
The
ImageWriter calling this
TIFFCompressor . |
Constructor and Description |
---|
TIFFCompressor(java.lang.String compressionType,
int compressionTagValue,
boolean isCompressionLossless)
Creates a compressor object for use in compressing TIFF data.
|
Modifier and Type | Method and Description |
---|---|
abstract int |
encode(byte[] b,
int off,
int width,
int height,
int[] bitsPerSample,
int scanlineStride)
Encodes the supplied image data, writing to the currently set
ImageOutputStream . |
int |
getCompressionTagValue()
Retrieve the value to be assigned to the TIFF Compression tag
in the TIFF image metadata.
|
java.lang.String |
getCompressionType()
Retrieve the name of the compression type supported by this compressor.
|
javax.imageio.metadata.IIOMetadata |
getMetadata()
Returns the current
IIOMetadata object. |
javax.imageio.stream.ImageOutputStream |
getStream()
Returns the
ImageOutputStream that will be written. |
javax.imageio.ImageWriter |
getWriter()
Returns the current
ImageWriter . |
boolean |
isCompressionLossless()
Retrieves a value indicating whether the compression is lossless.
|
void |
setMetadata(javax.imageio.metadata.IIOMetadata metadata)
Sets the value of the
metadata field. |
void |
setStream(javax.imageio.stream.ImageOutputStream stream)
Sets the
ImageOutputStream to be written. |
void |
setWriter(javax.imageio.ImageWriter writer)
Sets the value of the
writer field. |
protected javax.imageio.ImageWriter writer
ImageWriter
calling this
TIFFCompressor
.protected javax.imageio.metadata.IIOMetadata metadata
IIOMetadata
object containing metadata for the
current image.protected java.lang.String compressionType
protected int compressionTagValue
protected boolean isCompressionLossless
protected javax.imageio.stream.ImageOutputStream stream
ImageOutputStream
to be written.public TIFFCompressor(java.lang.String compressionType, int compressionTagValue, boolean isCompressionLossless)
TIFFImageWriteParam.setTIFFCompressor(TIFFCompressor)
method to override the compressor of a supported compression type or
to provide the implementation of the compression algorithm of an
unsupported compression type.
The parameters compressionTagValue
and
isCompressionLossless
are provided to accomodate
compression types which are unknown. A compression type is
"known" if it is either among those already supported by the
TIFF writer (see TIFFImageWriteParam
), or is listed in
the TIFF 6.0 specification but not supported. If the compression
type is unknown, the compressionTagValue
and
isCompressionLossless
parameters are ignored.
compressionType
- The name of the compression type.compressionTagValue
- The value to be assigned to the TIFF
Compression tag in the TIFF image metadata; ignored if
compressionType
is a known type.isCompressionLossless
- Whether the compression is lossless;
ignored if compressionType
is a known type.java.lang.IllegalArgumentException
- if compressionType
is
null
or compressionTagValue
is less than
1
.public java.lang.String getCompressionType()
public int getCompressionTagValue()
public boolean isCompressionLossless()
public void setStream(javax.imageio.stream.ImageOutputStream stream)
ImageOutputStream
to be written.stream
- an ImageOutputStream
to be written.getStream()
public javax.imageio.stream.ImageOutputStream getStream()
ImageOutputStream
that will be written.ImageOutputStream
.setStream(ImageOutputStream)
public void setWriter(javax.imageio.ImageWriter writer)
writer
field.writer
- the current ImageWriter
.getWriter()
public javax.imageio.ImageWriter getWriter()
ImageWriter
.ImageWriter
.setWriter(ImageWriter)
public void setMetadata(javax.imageio.metadata.IIOMetadata metadata)
metadata
field.metadata
- the IIOMetadata
object for the
image being written.getMetadata()
public javax.imageio.metadata.IIOMetadata getMetadata()
IIOMetadata
object.IIOMetadata
object for the image being
written.setMetadata(IIOMetadata)
public abstract int encode(byte[] b, int off, int width, int height, int[] bitsPerSample, int scanlineStride) throws java.io.IOException
ImageOutputStream
.b
- an array of byte
s containing the packed
but uncompressed image data.off
- the starting offset of the data to be written in the
array b
.width
- the width of the rectangle of pixels to be written.height
- the height of the rectangle of pixels to be written.bitsPerSample
- an array of int
s indicting
the number of bits used to represent each image sample within
a pixel.scanlineStride
- the number of bytes separating each
row of the input data.java.io.IOException
- if the supplied data cannot be encoded by
this TIFFCompressor
, or if any I/O error occurs
during writing.Copyright © 2014 Open Microscopy Environment