Module openj9.dtfj
Class AddressSpaceImageInputStream
java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
com.ibm.j9ddr.corereaders.tdump.zebedee.dumpreader.AddressSpaceImageInputStream
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable,ImageInputStream
This class implements ImageInputStream for an AddressSpace. You can use this to read data from
an AddressSpace as an alternative to using the methods defined in AddressSpace itself.
ImageInputStream provides a rich set of read methods. To use it you must first call seek() with
the address you wish to read from and then call the appropriate read method.
Note that at present it doesn't fully meet the ImageInputStream semantics in that it won't skip over gaps in the AddressSpace seamlessly. I might add that functionality if the demand is there. Also length returns -1 since it doesn't make sense to return a real value (?).
-
Field Summary
Fields declared in class javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new AddressSpaceImageInputStream for the given AddressSpace. -
Method Summary
Modifier and TypeMethodDescriptionintread()Read a byte from the current position.intread(byte[] b, int off, int len) Read some bytes from the current position and add len to streamPos.intreadInt()Read an int from the current position.longreadLong()Read a long from the current position.longRead an unsigned int from the current position.Methods declared in class javax.imageio.stream.ImageInputStreamImpl
checkClosed, close, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, length, mark, read, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readLine, readShort, readUnsignedByte, readUnsignedShort, readUTF, reset, seek, setBitOffset, setByteOrder, skipBytes, skipBytes
-
Constructor Details
-
AddressSpaceImageInputStream
Create a new AddressSpaceImageInputStream for the given AddressSpace.- Parameters:
space- the AddressSpace which this stream reads
-
-
Method Details
-
read
Read a byte from the current position. Also increments streamPos.- Specified by:
readin interfaceImageInputStream- Specified by:
readin classImageInputStreamImpl- Returns:
- the value of the next byte in the stream, or
-1if EOF is reached. - Throws:
IOException- if the stream has been closed.
-
read
Read some bytes from the current position and add len to streamPos.- Specified by:
readin interfaceImageInputStream- Specified by:
readin classImageInputStreamImpl- Parameters:
b- an array of bytes to be written to.off- the starting position withinbto write to.len- the maximum number of bytes to read.- Returns:
- the number of bytes actually read, or
-1to indicate EOF. - Throws:
IOException- if an I/O error occurs.
-
readInt
Read an int from the current position. Also increments streamPos. For efficiency to avoid multiple reads via ImageInputStream- Specified by:
readIntin interfaceDataInput- Specified by:
readIntin interfaceImageInputStream- Overrides:
readIntin classImageInputStreamImpl- Returns:
- a signed int value from the stream.
- Throws:
IOException- if an I/O error occurs.- See Also:
-
readUnsignedInt
Read an unsigned int from the current position. Also increments streamPos. For efficiency to avoid multiple reads via ImageInputStream- Specified by:
readUnsignedIntin interfaceImageInputStream- Overrides:
readUnsignedIntin classImageInputStreamImpl- Returns:
- an unsigned int value from the stream, as a long.
- Throws:
IOException- if an I/O error occurs.- See Also:
-
readLong
Read a long from the current position. Also increments streamPos. For efficiency to avoid multiple reads via ImageInputStream- Specified by:
readLongin interfaceDataInput- Specified by:
readLongin interfaceImageInputStream- Overrides:
readLongin classImageInputStreamImpl- Returns:
- a signed long value from the stream.
- Throws:
IOException- if an I/O error occurs.- See Also:
-