Module openj9.dtfj
Class AddressSpaceImageInputStream
java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
com.ibm.dtfj.corereaders.zos.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
ConstructorDescriptionCreate a new AddressSpaceImageInputStream for the given AddressSpace. -
Method Summary
Modifier and TypeMethodDescriptionint
read()
Read a byte from the current position.int
read
(byte[] b, int off, int len) Read some bytes from the current position and add len to streamPos.int
readInt()
Read an int from the current position.long
readLong()
Read a long from the current position.long
Read 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:
read
in interfaceImageInputStream
- Specified by:
read
in classImageInputStreamImpl
- Returns:
- the value of the next byte in the stream, or
-1
if 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:
read
in interfaceImageInputStream
- Specified by:
read
in classImageInputStreamImpl
- Parameters:
b
- an array of bytes to be written to.off
- the starting position withinb
to write to.len
- the maximum number of bytes to read.- Returns:
- the number of bytes actually read, or
-1
to 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:
readInt
in interfaceDataInput
- Specified by:
readInt
in interfaceImageInputStream
- Overrides:
readInt
in classImageInputStreamImpl
- Returns:
- a signed int value from the stream.
- Throws:
EOFException
- if the stream reaches the end before reading all the bytes.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:
readUnsignedInt
in interfaceImageInputStream
- Overrides:
readUnsignedInt
in classImageInputStreamImpl
- Returns:
- an unsigned int value from the stream, as a long.
- Throws:
EOFException
- if the stream reaches the end before reading all the bytes.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:
readLong
in interfaceDataInput
- Specified by:
readLong
in interfaceImageInputStream
- Overrides:
readLong
in classImageInputStreamImpl
- Returns:
- a signed long value from the stream.
- Throws:
EOFException
- if the stream reaches the end before reading all the bytes.IOException
- if an I/O error occurs.- See Also:
-