Package mars.mips.dump
Class AbstractDumpFormat
java.lang.Object
mars.mips.dump.AbstractDumpFormat
- All Implemented Interfaces:
DumpFormat
- Direct Known Subclasses:
AsciiTextDumpFormat
,BinaryDumpFormat
,BinaryTextDumpFormat
,HexTextDumpFormat
,IntelHexDumpFormat
,SegmentWindowDumpFormat
Abstract class for memory dump file formats. Provides constructors and
defaults for everything except the dumpMemoryRange method itself.
- Version:
- December 2007
- Author:
- Pete Sanderson
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractDumpFormat
(String name, String commandDescriptor, String description, String extension) Typical constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
dumpMemoryRange
(File file, int firstAddress, int lastAddress) Write MIPS memory contents according to the specification for this format.One-word description of format to be used by MARS command mode parser and user in conjunction with the "dump" option.Get a short description of the format, suitable for displaying along with the extension, in the file save dialog, or as a tool tip.Get the file extension associated with this format.toString()
String representing this object.
-
Constructor Details
-
AbstractDumpFormat
public AbstractDumpFormat(String name, String commandDescriptor, String description, String extension) Typical constructor. Note you cannot creates objects from this class but subclass constructor can call this one.- Parameters:
name
- Brief descriptive name to be displayed in selection list.commandDescriptor
- One-word descriptive name to be used by MARS command mode parser and user. Any spaces in this string will be removed.description
- Description to go with standard file extension for display in file save dialog or to be used as tool tip.extension
- Standard file extension for this format. Null if none.
-
-
Method Details
-
getFileExtension
Get the file extension associated with this format.- Specified by:
getFileExtension
in interfaceDumpFormat
- Returns:
- String containing file extension -- without the leading "." -- or null if there is no standard extension.
-
getDescription
Get a short description of the format, suitable for displaying along with the extension, in the file save dialog, or as a tool tip.- Specified by:
getDescription
in interfaceDumpFormat
- Returns:
- String containing short description to go with the extension or for use as tool tip. Possibly null.
-
toString
String representing this object.- Specified by:
toString
in interfaceDumpFormat
- Overrides:
toString
in classObject
- Returns:
- Name given for this object.
-
getCommandDescriptor
One-word description of format to be used by MARS command mode parser and user in conjunction with the "dump" option.- Specified by:
getCommandDescriptor
in interfaceDumpFormat
- Returns:
- One-word String describing the format.
-
dumpMemoryRange
public abstract void dumpMemoryRange(File file, int firstAddress, int lastAddress) throws AddressErrorException, IOException Write MIPS memory contents according to the specification for this format.- Specified by:
dumpMemoryRange
in interfaceDumpFormat
- Parameters:
file
- File in which to store MIPS memory contents.firstAddress
- first (lowest) memory address to dump. In bytes but must be on word boundary.lastAddress
- last (highest) memory address to dump. In bytes but must be on word boundary. Will dump the word that starts at this address.- Throws:
AddressErrorException
- if firstAddress is invalid or not on a word boundary.IOException
- if error occurs during file output.
-