java.lang.Object
javax.imageio.stream.ImageInputStreamImpl
com.ibm.j9ddr.corereaders.tdump.zebedee.dumpreader.Dump
- All Implemented Interfaces:
Closeable
,DataInput
,AutoCloseable
,ImageInputStream
This class represents an svcdump. It is the main class in the dumpreader package and
provides low-level access to the contents of an svcdump (eg the ability to read the contents
of an address in a given address space).
Implementation note: currently implemented by linking to the old svcdump.jar code (so you need to include svcdump.jar when using) but this dependency will eventually be removed.
-
Field Summary
FieldsFields declared in class javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos
-
Constructor Summary
ConstructorsConstructorDescriptionDump
(BufferedInputStream inputStream, String filename) Dump
(InputStream stream, boolean initialize) Creates a new instance of Dump from the given InputStream.Creates a new instance of Dump from the given filename.Creates a new instance of Dump from the given filename.Dump
(String filename, ImageInputStream stream) Creates a new instance of Dump from the given input stream (constructor used by J9 I think).Dump
(ImageInputStream in) Dump
(ImageInputStream in, boolean initialize) Creates a new instance of Dump from the given filename. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the file used to read the dumpgetAddressSpace
(int id) Returns the address space with the given id or null if it can't be found.Returns an array of all the address spaces in the dump.Returns the time when the dump was created.getName()
Return the pathname for this dumpReturns the z/OS product modification.Returns the z/OS product name.Returns the z/OS product release.Returns the z/OS product version.Returns an object representing the system trace table.getTitle()
Returns the title of the dump.void
Scan the dump and build the array of AddressSpaces.boolean
is64bit()
Returns true if this is a 64-bit dump.static boolean
Returns true if the given filename is a valid svcdump.long
length()
Get the length of the dump filevoid
Close the file used to read the dump (MVS datasets only).static Date
mvsClockToDate
(long clock) Convert an MVS style clock value to a Date object.int
read()
Reads an unsigned byte from the fileint
read
(byte[] buf) Read from the dump file into the given buffer.int
read
(byte[] buf, int off, int len) Read from the dump file into the given buffer.void
seek
(long offset) Seek to the given offset in the dump file.Methods declared in class javax.imageio.stream.ImageInputStreamImpl
checkClosed, finalize, flush, flushBefore, getBitOffset, getByteOrder, getFlushedPosition, getStreamPosition, isCached, isCachedFile, isCachedMemory, mark, readBit, readBits, readBoolean, readByte, readBytes, readChar, readDouble, readFloat, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedInt, readUnsignedShort, readUTF, reset, setBitOffset, setByteOrder, skipBytes, skipBytes
-
Field Details
-
DATABLOCKSIZE
public static final int DATABLOCKSIZESize of a block excluding header- See Also:
-
-
Constructor Details
-
Dump
Creates a new instance of Dump from the given filename. The filename must represent either an absolute or relative pathname of the dump file, or if running on z/os it can be an MVS dataset name (eg DGRIFF.MYDUMP).- Parameters:
filename
- the name of the dump to open- Throws:
FileNotFoundException
FileFormatException
-
Dump
-
Dump
public Dump(ImageInputStream in, boolean initialize) throws FileNotFoundException, FileFormatException Creates a new instance of Dump from the given filename. The filename must represent either an absolute or relative pathname of the dump file, or if running on z/os it can be an MVS dataset name (eg DGRIFF.MYDUMP).- Parameters:
initialize
- whether to initialize the dump as wellfilename
- the name of the dump to open- Throws:
FileNotFoundException
FileFormatException
-
Dump
Creates a new instance of Dump from the given filename. The filename must represent either an absolute or relative pathname of the dump file, or if running on z/os it can be an MVS dataset name (eg DGRIFF.MYDUMP).- Parameters:
filename
- the name of the dump to openinitialize
- whether to initialize the dump as well- Throws:
FileNotFoundException
FileFormatException
-
Dump
public Dump(InputStream stream, boolean initialize) throws FileNotFoundException, FileFormatException Creates a new instance of Dump from the given InputStream. The stream must represent either an absolute or relative pathname of the dump file, or if running on z/os it can be an MVS dataset name (eg DGRIFF.MYDUMP).- Parameters:
stream
- the stream to read frominitialize
- whether to initialize the dump as well- Throws:
FileNotFoundException
FileFormatException
-
Dump
public Dump(String filename, ImageInputStream stream) throws FileNotFoundException, FileFormatException Creates a new instance of Dump from the given input stream (constructor used by J9 I think).- Parameters:
filename
- the name of the dump - also used to open the cache filestream
- an ImageInputStream for the dump or null - used in preference to opening the file- Throws:
FileNotFoundException
FileFormatException
-
Dump
public Dump(BufferedInputStream inputStream, String filename) throws FileNotFoundException, FileFormatException
-
-
Method Details
-
isValid
Returns true if the given filename is a valid svcdump. -
initialize
Scan the dump and build the array of AddressSpaces. Every block of the dump is read to build a mapping of block memory addresses to file offsets, for each address space in the dump Each block has a header containing the AddressSpace ID and the memory address the block maps to. -
seek
Seek to the given offset in the dump file. This also handles MVS datasets in an efficient way (simply using fseek is too slow because the seek appears to read the file from the beginning every time!).- Specified by:
seek
in interfaceImageInputStream
- Overrides:
seek
in classImageInputStreamImpl
- Parameters:
offset
- the offset to seek to- Throws:
IOException
- if any other I/O error occurs.
-
read
Reads an unsigned byte from the file- Specified by:
read
in interfaceImageInputStream
- Specified by:
read
in classImageInputStreamImpl
- Returns:
- Throws:
IOException
-
read
Read from the dump file into the given buffer.- Specified by:
read
in interfaceImageInputStream
- Specified by:
read
in classImageInputStreamImpl
- Parameters:
buf
- the buffer to read intooff
- the offset into the buffer to start atlen
- 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.
-
read
Read from the dump file into the given buffer.- Specified by:
read
in interfaceImageInputStream
- Overrides:
read
in classImageInputStreamImpl
- Parameters:
buf
- the buffer to read into- Returns:
- the number of bytes actually read, or
-1
to indicate EOF. - Throws:
IOException
- if an I/O error occurs.
-
length
public long length()Get the length of the dump file- Specified by:
length
in interfaceImageInputStream
- Overrides:
length
in classImageInputStreamImpl
- Returns:
- -1L to indicate unknown length.
-
close
Close the file used to read the dump- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceImageInputStream
- Overrides:
close
in classImageInputStreamImpl
- Throws:
IOException
- if an I/O error occurs.
-
localClose
Close the file used to read the dump (MVS datasets only). Added this because need to let it know we have finished with the handle for MVS only. Need to clean this up.- Throws:
IOException
-
getAddressSpaces
Returns an array of all the address spaces in the dump. -
getAddressSpace
Returns the address space with the given id or null if it can't be found. -
is64bit
public boolean is64bit()Returns true if this is a 64-bit dump. Always returns false at the moment 'cos I haven't yet got my paws on a 64-bit dump. -
getTitle
Returns the title of the dump. -
getProductName
Returns the z/OS product name. -
getProductVersion
Returns the z/OS product version. -
getProductRelease
Returns the z/OS product release. -
getProductModification
Returns the z/OS product modification. -
mvsClockToDate
Convert an MVS style clock value to a Date object. -
getCreationDate
Returns the time when the dump was created. -
getSystemTrace
Returns an object representing the system trace table.- Throws:
IOException
-
getName
Return the pathname for this dump
-