OpenCores
URL https://opencores.org/ocsvn/usb_fpga_1_15/usb_fpga_1_15/trunk

Subversion Repositories usb_fpga_1_15

[/] [usb_fpga_1_15/] [trunk/] [java/] [ztex/] [IhxFile.java] - Diff between revs 2 and 3

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 3
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.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.