public class RawImageInputStream
extends java.lang.Object
implements javax.imageio.stream.ImageInputStream
ImageInputStream
containing several raw images with the same image type: the number of
the images, the image type, the offset for the first sample of each image,
and the image size information.
ImageInputStream methods are not commented individually.
These methods merely forward the call to the ImageInputStream
specified when the RawImageInputStream is constructed.
| Constructor and Description |
|---|
RawImageInputStream(javax.imageio.stream.ImageInputStream source,
javax.imageio.ImageTypeSpecifier type,
long[] imageOffsets,
java.awt.Dimension[] imageDimensions)
Constructor.
|
RawImageInputStream(javax.imageio.stream.ImageInputStream source,
org.xml.sax.InputSource xmlSource)
Constructor.
|
RawImageInputStream(javax.imageio.stream.ImageInputStream source,
java.awt.image.SampleModel sampleModel,
long[] imageOffsets,
java.awt.Dimension[] imageDimensions)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
void |
flushBefore(long pos) |
int |
getBitOffset() |
java.nio.ByteOrder |
getByteOrder() |
long |
getFlushedPosition() |
java.awt.Dimension |
getImageDimension(int imageIndex)
Retrieves the dimnsion of the
imageIndexth image. |
long |
getImageOffset(int imageIndex)
Retrieves the image offset of the
imageIndexth image. |
javax.imageio.ImageTypeSpecifier |
getImageType()
Retrieves the image type.
|
int |
getNumImages()
Retrieves the number of images in the
ImageInputStream. |
long |
getStreamPosition() |
boolean |
isCached() |
boolean |
isCachedFile() |
boolean |
isCachedMemory() |
long |
length() |
void |
mark() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
int |
readBit() |
long |
readBits(int numBits) |
boolean |
readBoolean() |
byte |
readByte() |
void |
readBytes(javax.imageio.stream.IIOByteBuffer buf,
int len) |
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
void |
readFully(char[] c,
int off,
int len) |
void |
readFully(double[] d,
int off,
int len) |
void |
readFully(float[] f,
int off,
int len) |
void |
readFully(int[] i,
int off,
int len) |
void |
readFully(long[] l,
int off,
int len) |
void |
readFully(short[] s,
int off,
int len) |
int |
readInt() |
java.lang.String |
readLine() |
long |
readLong() |
short |
readShort() |
int |
readUnsignedByte() |
long |
readUnsignedInt() |
int |
readUnsignedShort() |
java.lang.String |
readUTF() |
void |
reset() |
void |
seek(long pos) |
void |
setBitOffset(int bitOffset) |
void |
setByteOrder(java.nio.ByteOrder byteOrder) |
int |
skipBytes(int n) |
long |
skipBytes(long n) |
public RawImageInputStream(javax.imageio.stream.ImageInputStream source,
javax.imageio.ImageTypeSpecifier type,
long[] imageOffsets,
java.awt.Dimension[] imageDimensions)
source - The ImageInputStream containing all the raw
images.type - The ImageTypeSpecifier for all the images
in the stream.imageOffsets - The position of the first sample for each image
in the stream.imageDimensions - The image size for each image in the stream.java.lang.IllegalArgumentException - If the sizes of
imageOffsets
and imageDimensions are different or if
either array is null.public RawImageInputStream(javax.imageio.stream.ImageInputStream source,
java.awt.image.SampleModel sampleModel,
long[] imageOffsets,
java.awt.Dimension[] imageDimensions)
This constructor is the same as
RawImageInputStream(ImageInputStream,ImageTypeSpecifier,
long[],Dimension[]) except that a SampleModel is
supplied instead of an ImageTypeSpecifier. This
constructor creates a ColorModel for the supplied
SampleModel and then creates an
ImageTypeSpecifier.
Suitable ColorModels are guaranteed to exist
for all instances of ComponentSampleModel.
For 1- and 3- banded SampleModels, the
ColorModel will be opaque. For 2- and 4-banded
SampleModels, the output will use alpha transparency
which is not premultiplied. 1- and 2-banded data will use a
grayscale ColorSpace, and 3- and 4-banded data a sRGB
ColorSpace. Data with 5 or more bands will use a
ColorSpace which satisfies compatibility constraints
but is merely a placeholder and does not perform correct color
conversion to and from the C.I.E. XYZ and sRGB color spaces.
An instance of DirectColorModel will be created for
instances of SinglePixelPackedSampleModel with no more
than 4 bands.
An instance of IndexColorModel will be created for
instances of MultiPixelPackedSampleModel. The colormap
will be a grayscale ramp with 1 << numberOfBits
entries ranging from zero to at most 255.
source - The ImageInputStream containing all the raw
images.sampleModel - The SampleModel for all the images
in the stream.imageOffsets - The position of the first sample for each image
in the stream.imageDimensions - The image size for each image in the stream.java.lang.IllegalArgumentException - If sampleModel is null.java.lang.IllegalArgumentException - If the sizes of
imageOffsets
and imageDimensions are different or if
either array is null.java.lang.IllegalArgumentException - If it is not possible to create a
ColorModel from the supplied
SampleModel.public RawImageInputStream(javax.imageio.stream.ImageInputStream source,
org.xml.sax.InputSource xmlSource)
throws org.xml.sax.SAXException,
java.io.IOException
xmlSource must adhere to the following DTD:
<!DOCTYPE "com_sun_media_imageio_stream_raw_1.0" [
<!ELEMENT com_sun_media_imageio_stream_raw_1.0
(byteOrder?, offset?, width?, height?,
(ComponentSampleModel |
MultiPixelPackedSampleModel |
SinglePixelPackedSampleModel),
(ComponentColorModel |
DirectColorModel |
IndexColorModel)?)>
<!ATTLIST com_sun_media_imageio_stream_raw_1.0
xmlns CDATA #FIXED "http://com/sun/media/imageio">
<!ELEMENT byteOrder (#PCDATA)>
<!-- Byte order of data stream -->
<!-- Either "NETWORK" or "REVERSE" -->
<!-- Data type: String -->
<!ELEMENT offset (#PCDATA)>
<!-- Byte offset to the image data in the stream -->
<!-- Data type: long -->
<!ELEMENT width (#PCDATA)>
<!-- Image width; default value is SampleModel width -->
<!-- Data type: int -->
<!ELEMENT height (#PCDATA)>
<!-- Image height; default value is SampleModel height -->
<!-- Data type: int -->
<!ELEMENT ComponentSampleModel EMPTY>
<!-- ComponentSampleModel -->
<!ATTLIST ComponentSampleModel
dataType (BYTE | USHORT | SHORT | INT | FLOAT | DOUBLE) #REQUIRED
<!-- Data type: String -->
w CDATA #REQUIRED
<!-- SampleModel width -->
<!-- Data type: int -->
h CDATA #REQUIRED
<!-- SampleModel height -->
<!-- Data type: int -->
pixelStride CDATA "1"
<!-- SampleModel pixel stride -->
<!-- Data type: int -->
scanlineStride CDATA #REQUIRED
<!-- SampleModel line stride -->
<!-- Data type: int -->
bankIndices CDATA #IMPLIED
<!-- SampleModel bank indices -->
<!-- Data type: int array -->
bandOffsets CDATA #REQUIRED>
<!-- SampleModel band offsets -->
<!-- Data type: int array -->
<!ELEMENT MultiPixelPackedSampleModel EMPTY>
<!-- MultiPixelPackedSampleModel -->
<!ATTLIST MultiPixelPackedSampleModel
dataType (BYTE | USHORT | INT) #REQUIRED
<!-- Data type: String -->
w CDATA #REQUIRED
<!-- SampleModel width -->
<!-- Data type: int -->
h CDATA #REQUIRED
<!-- SampleModel height -->
<!-- Data type: int -->
numberOfBits CDATA #REQUIRED
<!-- Number of bits per pixel -->
<!-- Data type: int -->
scanlineStride CDATA #REQUIRED
<!-- SampleModel line stride -->
<!-- Data type: int -->
dataBitOffset CDATA "0">
<!-- Offset to first valid bit in a line -->
<!-- Data type: int -->
<!ELEMENT SinglePixelPackedSampleModel EMPTY>
<!-- SinglePixelPackedSampleModel -->
<!ATTLIST SinglePixelPackedSampleModel
dataType (BYTE | USHORT | INT) #REQUIRED
<!-- Data type: String -->
w CDATA #REQUIRED
<!-- SampleModel width -->
<!-- Data type: int -->
h CDATA #REQUIRED
<!-- SampleModel height -->
<!-- Data type: int -->
scanlineStride CDATA #REQUIRED
<!-- SampleModel line stride -->
<!-- Data type: int -->
bitMasks CDATA #REQUIRED>
<!-- Masks indicating RGBA positions -->
<!-- Data type: int -->
<!ELEMENT ComponentColorModel EMPTY>
<!-- ComponentColorModel -->
<!ATTLIST ComponentColorModel
colorSpace (CIEXYZ | GRAY | LINEAR_RGB | PYCC | sRGB | URL)
#REQUIRED
<!-- A string representing a predefined ColorSpace or a URI
representing the location of any ICC profile from which
a ColorSpace may be created. -->
<!-- Data type: String -->
bits CDATA #IMPLIED
<!-- Number of bits per color component -->
<!-- Data type: int -->
hasAlpha (true | false) #REQUIRED
<!-- Whether an alpha channel is present -->
<!-- Data type: boolean -->
isAlphaPremultiplied (true | false) #REQUIRED
<!-- Whether any alpha channel is premultiplied -->
<!-- Data type: boolean -->
transparency (BITMASK | OPAQUE | TRANSLUCENT) #REQUIRED
<!-- The type of transparency -->
transferType (BYTE | USHORT | SHORT | INT | FLOAT | DOUBLE)
#REQUIRED>
<!-- The data transfer type -->
<!ELEMENT DirectColorModel EMPTY>
<!-- DirectColorModel -->
<!ATTLIST DirectColorModel
colorSpace (LINEAR_RGB | sRGB | URL) #IMPLIED
<!-- A string representing a predefined RGB ColorSpace or a
URL representing the location of any ICC profile from
which an RGB ColorSpace may be created. -->
<!-- Data type: String -->
bits CDATA #REQUIRED
<!-- Number of bits per color component -->
<!-- Data type: int -->
rmask CDATA #REQUIRED
<!-- Bitmask of the red component -->
<!-- Data type: int -->
gmask CDATA #REQUIRED
<!-- Bitmask of the grenn component -->
<!-- Data type: int -->
bmask CDATA #REQUIRED
<!-- Bitmask of the blue component -->
<!-- Data type: int -->
amask CDATA "0">
<!-- Bitmask of the alpha component -->
<!-- Data type: int -->
<!ELEMENT IndexColorModel EMPTY>
<!-- IndexColorModel -->
<!ATTLIST IndexColorModel
bits CDATA #REQUIRED
<!-- Number of bits per color component -->
<!-- Data type: int -->
size CDATA #REQUIRED
<!-- Number of elements in the colormap -->
<!-- Data type: int -->
r CDATA #REQUIRED
<!-- Red elements of the colormap -->
<!-- Data type: byte array -->
g CDATA #REQUIRED
<!-- Green elements of the colormap -->
<!-- Data type: byte array -->
b CDATA #REQUIRED
<!-- Blue elements of the colormap -->
<!-- Data type: byte array -->
a CDATA #IMPLIED>
<!-- Alpha elements of the colormap -->
<!-- Data type: byte array -->
]>
source - The ImageInputStream containing all the raw
images.xmlSource - The org.xml.sax.InputSource to provide
the xml document in which the stream structure is defined.java.lang.RuntimeException - If the parse configuration isn't correct.java.lang.IllegalArgumentException - If the number of "width" elements isn't
the same as the number of "height" elements.org.xml.sax.SAXException - If one is thrown in parsing.java.io.IOException - If one is thrown in parsing, or creating color space
from a URL.public javax.imageio.ImageTypeSpecifier getImageType()
public long getImageOffset(int imageIndex)
imageIndexth image.imageIndex - the index of the image of interest.java.lang.IllegalArgumentException - If the provided parameter is out of
range.public java.awt.Dimension getImageDimension(int imageIndex)
imageIndexth image.imageIndex - the index of the image of interest.java.lang.IllegalArgumentException - If the provided parameter is out of
rangle.public int getNumImages()
ImageInputStream.public void setByteOrder(java.nio.ByteOrder byteOrder)
setByteOrder in interface javax.imageio.stream.ImageInputStreampublic java.nio.ByteOrder getByteOrder()
getByteOrder in interface javax.imageio.stream.ImageInputStreampublic int read()
throws java.io.IOException
read in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic int read(byte[] b)
throws java.io.IOException
read in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void readBytes(javax.imageio.stream.IIOByteBuffer buf,
int len)
throws java.io.IOException
readBytes in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic boolean readBoolean()
throws java.io.IOException
readBoolean in interface java.io.DataInputreadBoolean in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic byte readByte()
throws java.io.IOException
readByte in interface java.io.DataInputreadByte in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic int readUnsignedByte()
throws java.io.IOException
readUnsignedByte in interface java.io.DataInputreadUnsignedByte in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic short readShort()
throws java.io.IOException
readShort in interface java.io.DataInputreadShort in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic int readUnsignedShort()
throws java.io.IOException
readUnsignedShort in interface java.io.DataInputreadUnsignedShort in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic char readChar()
throws java.io.IOException
readChar in interface java.io.DataInputreadChar in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic int readInt()
throws java.io.IOException
readInt in interface java.io.DataInputreadInt in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic long readUnsignedInt()
throws java.io.IOException
readUnsignedInt in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic long readLong()
throws java.io.IOException
readLong in interface java.io.DataInputreadLong in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic float readFloat()
throws java.io.IOException
readFloat in interface java.io.DataInputreadFloat in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic double readDouble()
throws java.io.IOException
readDouble in interface java.io.DataInputreadDouble in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic java.lang.String readLine()
throws java.io.IOException
readLine in interface java.io.DataInputreadLine in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic java.lang.String readUTF()
throws java.io.IOException
readUTF in interface java.io.DataInputreadUTF in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
readFully in interface java.io.DataInputreadFully in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void readFully(byte[] b)
throws java.io.IOException
readFully in interface java.io.DataInputreadFully in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void readFully(short[] s,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void readFully(char[] c,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void readFully(int[] i,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void readFully(long[] l,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void readFully(float[] f,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void readFully(double[] d,
int off,
int len)
throws java.io.IOException
readFully in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic long getStreamPosition()
throws java.io.IOException
getStreamPosition in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic int getBitOffset()
throws java.io.IOException
getBitOffset in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void setBitOffset(int bitOffset)
throws java.io.IOException
setBitOffset in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic int readBit()
throws java.io.IOException
readBit in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic long readBits(int numBits)
throws java.io.IOException
readBits in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic long length()
throws java.io.IOException
length in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic int skipBytes(int n)
throws java.io.IOException
skipBytes in interface java.io.DataInputskipBytes in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic long skipBytes(long n)
throws java.io.IOException
skipBytes in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void seek(long pos)
throws java.io.IOException
seek in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void mark()
mark in interface javax.imageio.stream.ImageInputStreampublic void reset()
throws java.io.IOException
reset in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void flushBefore(long pos)
throws java.io.IOException
flushBefore in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionpublic long getFlushedPosition()
getFlushedPosition in interface javax.imageio.stream.ImageInputStreampublic boolean isCached()
isCached in interface javax.imageio.stream.ImageInputStreampublic boolean isCachedMemory()
isCachedMemory in interface javax.imageio.stream.ImageInputStreampublic boolean isCachedFile()
isCachedFile in interface javax.imageio.stream.ImageInputStreampublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in interface javax.imageio.stream.ImageInputStreamjava.io.IOExceptionCopyright © 2014 Open Microscopy Environment