Line 56... |
Line 56... |
|
|
// ******* IhxFile *************************************************************
|
// ******* IhxFile *************************************************************
|
/**
|
/**
|
* Constructs an instance from a given file name.
|
* Constructs an instance from a given file name.
|
* This method can also read system resources, e.g. files from the current jar archive.
|
* This method can also read system resources, e.g. files from the current jar archive.
|
* @param fileName The file name.
|
* @param in Input stream from which the ihx file is read.
|
|
* @param name Name of the input.
|
* @throws IOException If an read error occurred.
|
* @throws IOException If an read error occurred.
|
* @throws IhxFileDamagedException If the ihx file is damaged.
|
* @throws IhxFileDamagedException If the ihx file is damaged.
|
*/
|
*/
|
public IhxFile ( String fileName ) throws IOException, IhxFileDamagedException {
|
public IhxFile ( InputStream in, String name ) throws IOException, IhxFileDamagedException {
|
InputStream in = JInputStream.getInputStream( fileName );
|
|
int b, len, cs, addr;
|
int b, len, cs, addr;
|
byte buf[] = new byte[255];
|
byte buf[] = new byte[255];
|
boolean eof = false;
|
boolean eof = false;
|
int line = 0;
|
int line = 0;
|
|
|
Line 118... |
Line 118... |
throw new IhxParseException( "Invalid record type: " + b );
|
throw new IhxParseException( "Invalid record type: " + b );
|
}
|
}
|
}
|
}
|
}
|
}
|
catch ( IhxParseException e ) {
|
catch ( IhxParseException e ) {
|
throw new IhxFileDamagedException ( fileName, line, e.getLocalizedMessage() );
|
throw new IhxFileDamagedException ( name, line, e.getLocalizedMessage() );
|
}
|
}
|
|
|
try {
|
try {
|
in.close();
|
in.close();
|
}
|
}
|
catch ( Exception e ) {
|
catch ( Exception e ) {
|
System.err.println( "Warning: Error closing file " + fileName + ": " + e.getLocalizedMessage() );
|
System.err.println( "Warning: Error closing file " + name + ": " + e.getLocalizedMessage() );
|
|
}
|
}
|
}
|
|
|
|
/**
|
|
* Constructs an instance from a given file name.
|
|
* This method can also read system resources, e.g. files from the current jar archive.
|
|
* @param fileName The file name.
|
|
* @throws IOException If an read error occurred.
|
|
* @throws IhxFileDamagedException If the ihx file is damaged.
|
|
*/
|
|
public IhxFile ( String fileName ) throws IOException, IhxFileDamagedException {
|
|
this( JInputStream.getInputStream( fileName ), fileName );
|
}
|
}
|
|
|
// ******* dataInfo ************************************************************
|
// ******* dataInfo ************************************************************
|
/**
|
/**
|
* Print out some information about the memory usage.
|
* Print out some information about the memory usage.
|