- java.lang.Object
-
- javax.imageio.stream.ImageInputStreamImpl
-
- com.ibm.dtfj.corereaders.zos.dumpreader.Dump
-
- All Implemented Interfaces:
Closeable,DataInput,AutoCloseable,ImageInputStream
public final class Dump extends ImageInputStreamImpl
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. Note: zebedee dependency on svcdump.jar has been removed
-
-
Field Summary
-
Fields declared in class javax.imageio.stream.ImageInputStreamImpl
bitOffset, byteOrder, flushedPos, streamPos
-
-
Constructor Summary
Constructors Constructor Description Dump(String filename)Creates a new instance of Dump from the given filename.Dump(String filename, SearchListener[] listeners)Creates a new instance of Dump from the given filename.Dump(String filename, ImageInputStream stream, boolean createCacheFile)Creates a new instance of Dump from the given filename.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AddressSpace[]getAddressSpaces()Returns an array of all the address spaces in the dump.DategetCreationDate()Returns the time when the dump was created.StringgetProductModification()Returns the z/OS product modification.StringgetProductName()Returns the z/OS product name.StringgetProductRelease()Returns the z/OS product release.StringgetProductVersion()Returns the z/OS product version.StringgetTitle()Returns the title of the dump.booleanis64bit()Returns true if this is a 64-bit dump.static booleanisValid(String filename)Returns true if the given filename is a valid svcdump.longlength()Get the length of the dump filestatic DatemvsClockToDate(long clock)Convert an MVS style clock value to a Date object.intread()Reads an unsigned byte from the fileintread(byte[] buf)Read from the dump file into the given buffer.intread(byte[] buf, int off, int len)Read from the dump file into the given buffer.voidseek(long offset)Seek to the given offset in the dump file.-
Methods declared in class javax.imageio.stream.ImageInputStreamImpl
checkClosed, close, 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
-
-
-
-
Constructor Detail
-
Dump
public Dump(String filename) throws FileNotFoundException
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
-
Dump
public Dump(String filename, ImageInputStream stream, boolean createCacheFile) throws FileNotFoundException
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). Alternatively an ImageInputStream can be provided if the file is already open.- Parameters:
filename- the name of the dump to open, also used to open the cache filestream- an ImageInputStream for the dump or null - used in preference to opening the filecreateCacheFile- Create a cache file based on the filename- Throws:
FileNotFoundException
-
Dump
public Dump(String filename, SearchListener[] listeners) throws FileNotFoundException
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.This constructor also supplies an array of
SearchListeners to inform the caller of matches found whilst scanning the dump. Note that this will force a scan of the dump which is otherwise normally only done the first time this dump is opened. (XXX can probably avoid this by cacheing earlier search results).- Parameters:
filename- the name of the dump to openlisteners- the array ofSearchListeners to be notified of interesting matches- Throws:
FileNotFoundException
-
-
Method Detail
-
isValid
public static boolean isValid(String filename)
Returns true if the given filename is a valid svcdump.
-
seek
public void seek(long offset) throws IOExceptionSeek 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:
seekin interfaceImageInputStream- Overrides:
seekin classImageInputStreamImpl- Parameters:
offset- the offset to seek to- Throws:
IOException- if any other I/O error occurs.
-
read
public int read() throws IOExceptionReads an unsigned byte from the file- Specified by:
readin interfaceImageInputStream- Specified by:
readin classImageInputStreamImpl- Returns:
- Throws:
IOException
-
read
public int read(byte[] buf, int off, int len) throws IOExceptionRead from the dump file into the given buffer.- Specified by:
readin interfaceImageInputStream- Specified by:
readin 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
-1to indicate EOF. - Throws:
IOException- if an I/O error occurs.
-
read
public int read(byte[] buf) throws IOExceptionRead from the dump file into the given buffer.- Specified by:
readin interfaceImageInputStream- Overrides:
readin classImageInputStreamImpl- Parameters:
buf- the buffer to read into- Returns:
- the number of bytes actually read, or
-1to indicate EOF. - Throws:
IOException- if an I/O error occurs.
-
length
public long length()
Get the length of the dump file- Specified by:
lengthin interfaceImageInputStream- Overrides:
lengthin classImageInputStreamImpl- Returns:
- -1L to indicate unknown length.
-
getAddressSpaces
public AddressSpace[] getAddressSpaces()
Returns an array of all the address spaces in the dump.
-
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
public String getTitle()
Returns the title of the dump.
-
getProductName
public String getProductName()
Returns the z/OS product name.
-
getProductVersion
public String getProductVersion()
Returns the z/OS product version.
-
getProductRelease
public String getProductRelease()
Returns the z/OS product release.
-
getProductModification
public String getProductModification()
Returns the z/OS product modification.
-
mvsClockToDate
public static Date mvsClockToDate(long clock)
Convert an MVS style clock value to a Date object.
-
getCreationDate
public Date getCreationDate()
Returns the time when the dump was created.
-
-