Package de.pco.imageio
Class RawImageInputStream
java.lang.Object
de.pco.imageio.RawImageInputStream
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable,ImageInputStream
public class RawImageInputStream extends Object implements ImageInputStream
Class for encapsulating the ImageData or a list of them (recorded from the
camera or loaded from the file) for the input of
RawImageReader. Opens a substream
on a particular image by openSubstreamOnImage(int) and redirect all the methods
of ImageInputStream to it.- Author:
- PCO
-
Constructor Summary
Constructors Constructor Description RawImageInputStream(AbstractImageData image)Constructor from the single imageRawImageInputStream(List<? extends AbstractImageData> images)Constructor from the list of the images. -
Method Summary
Modifier and Type Method Description voidclose()Closes the substream.voidflush()voidflushBefore(long pos)intgetBitOffset()ByteOrdergetByteOrder()longgetFlushedPosition()intgetHeight()Returns the height of the images in the stream.ImageMetadatagetMetadata(int imageIndex)Returns the metadata for particular image in the stream (a substream on this image does not have to be opened).intgetNumImages()Returns the number of images in the stream.longgetStreamPosition()intgetWidth()Returns the width of the images in the stream.booleanisCached()booleanisCachedFile()booleanisCachedMemory()booleanisCompressed()Returns whether the inputs are the compressed images (with the values of unsigned bytes).longlength()voidmark()voidopenSubstreamOnImage(int index)Since the RawImageInputStream can contain data of more images the substream on a particular image have to be opened by this method.intread()Reads from the stream;intread(byte[] b)intread(byte[] b, int off, int len)Reads from the stream into a byte array.intreadBit()longreadBits(int numBits)booleanreadBoolean()bytereadByte()voidreadBytes(IIOByteBuffer buf, int len)charreadChar()doublereadDouble()floatreadFloat()voidreadFully(byte[] b)voidreadFully(byte[] b, int off, int len)voidreadFully(char[] c, int off, int len)voidreadFully(double[] d, int off, int len)voidreadFully(float[] f, int off, int len)voidreadFully(int[] i, int off, int len)voidreadFully(long[] l, int off, int len)voidreadFully(short[] s, int off, int len)intreadInt()StringreadLine()longreadLong()shortreadShort()intreadUnsignedByte()longreadUnsignedInt()intreadUnsignedShort()StringreadUTF()voidreset()voidseek(long pos)voidsetBitOffset(int bitOffset)voidsetByteOrder(ByteOrder byteOrder)Byte order are set globally for the whole RawImageInputStream and then propagated to the particular substream.intskipBytes(int n)longskipBytes(long n)
-
Constructor Details
-
RawImageInputStream
Constructor from the list of the images.- Parameters:
images-
-
RawImageInputStream
Constructor from the single image- Parameters:
imageData-
-
-
Method Details
-
read
Reads from the stream;- Specified by:
readin interfaceImageInputStream- Throws:
IOException
-
read
Reads from the stream into a byte array.- Specified by:
readin interfaceImageInputStream- Throws:
IOException
-
isCompressed
public boolean isCompressed()Returns whether the inputs are the compressed images (with the values of unsigned bytes).- Returns:
-
getWidth
public int getWidth()Returns the width of the images in the stream.- Returns:
-
getHeight
public int getHeight()Returns the height of the images in the stream.- Returns:
-
getNumImages
public int getNumImages()Returns the number of images in the stream.- Returns:
-
getMetadata
Returns the metadata for particular image in the stream (a substream on this image does not have to be opened).- Parameters:
imageIndex-- Returns:
-
openSubstreamOnImage
Since the RawImageInputStream can contain data of more images the substream on a particular image have to be opened by this method. All the standard ImageInputStream methods will then be redirected to this substream.- Parameters:
index-- Throws:
IOException
-
setByteOrder
Byte order are set globally for the whole RawImageInputStream and then propagated to the particular substream.- Specified by:
setByteOrderin interfaceImageInputStream
-
getByteOrder
- Specified by:
getByteOrderin interfaceImageInputStream
-
read
- Specified by:
readin interfaceImageInputStream- Throws:
IOException
-
readBytes
- Specified by:
readBytesin interfaceImageInputStream- Throws:
IOException
-
readBoolean
- Specified by:
readBooleanin interfaceDataInput- Specified by:
readBooleanin interfaceImageInputStream- Throws:
IOException
-
readByte
- Specified by:
readBytein interfaceDataInput- Specified by:
readBytein interfaceImageInputStream- Throws:
IOException
-
readUnsignedByte
- Specified by:
readUnsignedBytein interfaceDataInput- Specified by:
readUnsignedBytein interfaceImageInputStream- Throws:
IOException
-
readShort
- Specified by:
readShortin interfaceDataInput- Specified by:
readShortin interfaceImageInputStream- Throws:
IOException
-
readUnsignedShort
- Specified by:
readUnsignedShortin interfaceDataInput- Specified by:
readUnsignedShortin interfaceImageInputStream- Throws:
IOException
-
readChar
- Specified by:
readCharin interfaceDataInput- Specified by:
readCharin interfaceImageInputStream- Throws:
IOException
-
readInt
- Specified by:
readIntin interfaceDataInput- Specified by:
readIntin interfaceImageInputStream- Throws:
IOException
-
readUnsignedInt
- Specified by:
readUnsignedIntin interfaceImageInputStream- Throws:
IOException
-
readLong
- Specified by:
readLongin interfaceDataInput- Specified by:
readLongin interfaceImageInputStream- Throws:
IOException
-
readFloat
- Specified by:
readFloatin interfaceDataInput- Specified by:
readFloatin interfaceImageInputStream- Throws:
IOException
-
readDouble
- Specified by:
readDoublein interfaceDataInput- Specified by:
readDoublein interfaceImageInputStream- Throws:
IOException
-
readLine
- Specified by:
readLinein interfaceDataInput- Specified by:
readLinein interfaceImageInputStream- Throws:
IOException
-
readUTF
- Specified by:
readUTFin interfaceDataInput- Specified by:
readUTFin interfaceImageInputStream- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceDataInput- Specified by:
readFullyin interfaceImageInputStream- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceDataInput- Specified by:
readFullyin interfaceImageInputStream- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceImageInputStream- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceImageInputStream- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceImageInputStream- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceImageInputStream- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceImageInputStream- Throws:
IOException
-
readFully
- Specified by:
readFullyin interfaceImageInputStream- Throws:
IOException
-
getStreamPosition
- Specified by:
getStreamPositionin interfaceImageInputStream- Throws:
IOException
-
getBitOffset
- Specified by:
getBitOffsetin interfaceImageInputStream- Throws:
IOException
-
setBitOffset
- Specified by:
setBitOffsetin interfaceImageInputStream- Throws:
IOException
-
readBit
- Specified by:
readBitin interfaceImageInputStream- Throws:
IOException
-
readBits
- Specified by:
readBitsin interfaceImageInputStream- Throws:
IOException
-
length
- Specified by:
lengthin interfaceImageInputStream- Throws:
IOException
-
skipBytes
- Specified by:
skipBytesin interfaceDataInput- Specified by:
skipBytesin interfaceImageInputStream- Throws:
IOException
-
skipBytes
- Specified by:
skipBytesin interfaceImageInputStream- Throws:
IOException
-
seek
- Specified by:
seekin interfaceImageInputStream- Throws:
IOException
-
mark
public void mark()- Specified by:
markin interfaceImageInputStream
-
reset
- Specified by:
resetin interfaceImageInputStream- Throws:
IOException
-
flushBefore
- Specified by:
flushBeforein interfaceImageInputStream- Throws:
IOException
-
flush
- Specified by:
flushin interfaceImageInputStream- Throws:
IOException
-
getFlushedPosition
public long getFlushedPosition()- Specified by:
getFlushedPositionin interfaceImageInputStream
-
isCached
public boolean isCached()- Specified by:
isCachedin interfaceImageInputStream
-
isCachedMemory
public boolean isCachedMemory()- Specified by:
isCachedMemoryin interfaceImageInputStream
-
isCachedFile
public boolean isCachedFile()- Specified by:
isCachedFilein interfaceImageInputStream
-
close
Closes the substream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceImageInputStream- Throws:
IOException
-