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
public final class AddressSpaceImageInputStream extends ImageInputStreamImpl
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
Constructors Constructor Description AddressSpaceImageInputStream(AddressSpace space)Create a new AddressSpaceImageInputStream for the given AddressSpace.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intread()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.longreadUnsignedInt()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 Detail
-
AddressSpaceImageInputStream
public AddressSpaceImageInputStream(AddressSpace space)
Create a new AddressSpaceImageInputStream for the given AddressSpace.- Parameters:
space- the AddressSpace which this stream reads
-
-
Method Detail
-
read
public int read() throws IOExceptionRead 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
public int read(byte[] b, int off, int len) throws IOExceptionRead 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
public int readInt() throws IOExceptionRead 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:
EOFException- if the stream reaches the end before reading all the bytes.IOException- if an I/O error occurs.- See Also:
ImageInputStream.getByteOrder()
-
readUnsignedInt
public long readUnsignedInt() throws IOExceptionRead 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:
EOFException- if the stream reaches the end before reading all the bytes.IOException- if an I/O error occurs.- See Also:
ImageInputStream.getByteOrder()
-
readLong
public long readLong() throws IOExceptionRead 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:
EOFException- if the stream reaches the end before reading all the bytes.IOException- if an I/O error occurs.- See Also:
ImageInputStream.getByteOrder()
-
-