com.cmpware.elf
Class Elf

java.lang.Object
  extended by com.cmpware.elf.Elf

public class Elf
extends java.lang.Object

This describes the interface to the ELF executable file format.

Copyright (c) 2004 Cmpware, Inc. All Rights Reserved.

Author:
SAG

Field Summary
static java.lang.String copyright
          Copyright string
 Dwarf2 dwarf2
          The DWARF2 debug data
 ElfHeader elfHeader
          The ELF Header
 ProgramHeader[] programHeader
          The Program Headers
 SectionHeader[] sectionHeader
          The Section Headers
 StringTable sectionNameStringTable
          The section name string table
 
Constructor Summary
Elf()
           
 
Method Summary
 int addrBytes()
          This method returns the number of byte in an address.
 java.lang.String getFilename()
          This method returns the file name of the ELF file.
 byte[] getRaw()
          This method returns the raw data read from the input file.
 long getTocAddr()
          This method returns the address offset of the TOC section.
 boolean isELF()
          This method returns true if the file is an ELF file and false otherwise.
 void read(java.lang.String fileName)
          This method attempts to read an ELF format executable file.
 boolean swapBytes()
          This method indicates if endian "byte swapping" should be performed on data in the file.
 java.lang.String toString()
          This method returns a string representation of the ELF file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

copyright

public static final java.lang.String copyright
Copyright string

See Also:
Constant Field Values

elfHeader

public ElfHeader elfHeader
The ELF Header


programHeader

public ProgramHeader[] programHeader
The Program Headers


sectionHeader

public SectionHeader[] sectionHeader
The Section Headers


sectionNameStringTable

public StringTable sectionNameStringTable
The section name string table


dwarf2

public Dwarf2 dwarf2
The DWARF2 debug data

Constructor Detail

Elf

public Elf()
Method Detail

read

public void read(java.lang.String fileName)
          throws java.io.IOException
This method attempts to read an ELF format executable file.

Parameters:
fileName - The name of the ELF file to be read.
Throws:
java.io.IOException - This method throws an IO Exception for any IO errors when reading the file.

getRaw

public byte[] getRaw()
This method returns the raw data read from the input file.

Returns:
This method returns the raw data read from the input file.

isELF

public boolean isELF()
This method returns true if the file is an ELF file and false otherwise.

Returns:
This method returns true if the file is an ELF file and false otherwise.

swapBytes

public boolean swapBytes()
This method indicates if endian "byte swapping" should be performed on data in the file. Since Java is always "big endian" (ELFDATA2MSB) this method returns true if the ELF file encoding is ELFDATA2LSB and false otherwise.

Returns:
This method indicates if endian "byte swapping" should be performed on data in the file. Since Java is always "big endian" (ELFDATA2MSB) this method returns true if the ELF file encoding is ELFDATA2LSB and false otherwise.

addrBytes

public int addrBytes()
This method returns the number of byte in an address. This this typically 4 (for 32-bit machines) or 8 (for 64-bit machines).

Returns:
This method returns the number of byte in an address.

getFilename

public java.lang.String getFilename()
This method returns the file name of the ELF file.

Returns:
This method returns the file name of the ELF file.

getTocAddr

public long getTocAddr()
This method returns the address offset of the TOC section. If there is not TOC section a zero is returned.

Returns:
This method returns the address offset of the TOC section.

toString

public java.lang.String toString()
This method returns a string representation of the ELF file.

Overrides:
toString in class java.lang.Object
Returns:
This method returns a string representation of the ELF file.