com.cmpware.elf
Class ElfHeader

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

public class ElfHeader
extends java.lang.Object

This describes the ELF Header.

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

Author:
SAG

Field Summary
static java.lang.String copyright
          Copyright string
 int e_ehsize
          The ELF header size (in bytes)
 long e_entry
          The entry point (virtual address)
 int e_flags
          Processor-specific flags
 int e_machine
          The machine type
 int e_phentsize
          Program header table entry size
 int e_phnum
          The number of Program header table entries
 long e_phoff
          Program Header Table's offset (bytes)
 int e_shentsize
          Section Header Entry size (bytes)
 int e_shnum
          The number of Section headers
 long e_shoff
          Section header table offset (bytes)
 int e_shstrndx
          The string table index (in section header table)
 int e_type
          The object file type
 int e_version
          The file object version
static int EI_CLASS
          File class (e_ident[])
static int EI_DATA
          Data encoding (e_ident[])
static int EI_MAG0
          File identification (e_ident[])
static int EI_MAG1
          File identification (e_ident[])
static int EI_MAG2
          File identification (e_ident[])
static int EI_MAG3
          File identification (e_ident[])
static int EI_NIDENT
          The length of the identification string
static int EI_PAD
          Start of padding bytes (e_ident[])
static int EI_VERSION
          File version (e_ident[])
static int ELFCLASS32
          32-bit objects (e_ident[EI_CLASS])
static int ELFCLASS64
          64-bit objects (e_ident[EI_CLASS])
static int ELFCLASSNONE
          Invalid class (e_ident[EI_CLASS])
static int ELFDATA2LSB
          "Little endian" encoding (e_ident[EI_DATA])
static int ELFDATA2MSB
          "Big endian" encoding (e_ident[EI_DATA])
static int ELFDATANONE
          Invalid data encoding (e_ident[EI_DATA])
static int EM_386
          Intel 80386
static int EM_68K
          Motorola 68000
static int EM_860
          Intel 80860
static int EM_88K
          Motorola 88000
static int EM_M32
          AT&T WE32100
static int EM_MIPS
          MIPS RS3000
static int EM_NONE
          No machine
static int EM_SPARC
          SPARC
static int ET_CORE
          Core file
static int ET_DYN
          Shared object file
static int ET_EXEC
          Executable file
static int ET_NONE
          No file type
static int ET_REL
          Relocatable file
static int EV_CURRENT
          Current version
static int EV_NONE
          Invalid version
 int fileClass
          The file class
 int fileEncoding
          The data encoding
 int fileIdent
          The identification bytes '0x7f', 'E', 'L', 'F'
 int fileVersion
          The file version
 
Constructor Summary
ElfHeader()
           
 
Method Summary
 void read(ElfInputStream eis)
          This method fills in the ELF Header fields.
 java.lang.String toString()
          This method returns a string representation of the ELF header.
 void write(ElfOutputStream eos)
          This method writes out the ELF Header fields.
 
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

EI_NIDENT

public static final int EI_NIDENT
The length of the identification string

See Also:
Constant Field Values

EI_MAG0

public static final int EI_MAG0
File identification (e_ident[])

See Also:
Constant Field Values

EI_MAG1

public static final int EI_MAG1
File identification (e_ident[])

See Also:
Constant Field Values

EI_MAG2

public static final int EI_MAG2
File identification (e_ident[])

See Also:
Constant Field Values

EI_MAG3

public static final int EI_MAG3
File identification (e_ident[])

See Also:
Constant Field Values

EI_CLASS

public static final int EI_CLASS
File class (e_ident[])

See Also:
Constant Field Values

EI_DATA

public static final int EI_DATA
Data encoding (e_ident[])

See Also:
Constant Field Values

EI_VERSION

public static final int EI_VERSION
File version (e_ident[])

See Also:
Constant Field Values

EI_PAD

public static final int EI_PAD
Start of padding bytes (e_ident[])

See Also:
Constant Field Values

ET_NONE

public static final int ET_NONE
No file type

See Also:
Constant Field Values

ET_REL

public static final int ET_REL
Relocatable file

See Also:
Constant Field Values

ET_EXEC

public static final int ET_EXEC
Executable file

See Also:
Constant Field Values

ET_DYN

public static final int ET_DYN
Shared object file

See Also:
Constant Field Values

ET_CORE

public static final int ET_CORE
Core file

See Also:
Constant Field Values

EV_NONE

public static final int EV_NONE
Invalid version

See Also:
Constant Field Values

EV_CURRENT

public static final int EV_CURRENT
Current version

See Also:
Constant Field Values

EM_NONE

public static final int EM_NONE
No machine

See Also:
Constant Field Values

EM_M32

public static final int EM_M32
AT&T WE32100

See Also:
Constant Field Values

EM_SPARC

public static final int EM_SPARC
SPARC

See Also:
Constant Field Values

EM_386

public static final int EM_386
Intel 80386

See Also:
Constant Field Values

EM_68K

public static final int EM_68K
Motorola 68000

See Also:
Constant Field Values

EM_88K

public static final int EM_88K
Motorola 88000

See Also:
Constant Field Values

EM_860

public static final int EM_860
Intel 80860

See Also:
Constant Field Values

EM_MIPS

public static final int EM_MIPS
MIPS RS3000

See Also:
Constant Field Values

ELFCLASSNONE

public static final int ELFCLASSNONE
Invalid class (e_ident[EI_CLASS])

See Also:
Constant Field Values

ELFCLASS32

public static final int ELFCLASS32
32-bit objects (e_ident[EI_CLASS])

See Also:
Constant Field Values

ELFCLASS64

public static final int ELFCLASS64
64-bit objects (e_ident[EI_CLASS])

See Also:
Constant Field Values

ELFDATANONE

public static final int ELFDATANONE
Invalid data encoding (e_ident[EI_DATA])

See Also:
Constant Field Values

ELFDATA2LSB

public static final int ELFDATA2LSB
"Little endian" encoding (e_ident[EI_DATA])

See Also:
Constant Field Values

ELFDATA2MSB

public static final int ELFDATA2MSB
"Big endian" encoding (e_ident[EI_DATA])

See Also:
Constant Field Values

fileIdent

public int fileIdent
The identification bytes '0x7f', 'E', 'L', 'F'


fileClass

public int fileClass
The file class


fileEncoding

public int fileEncoding
The data encoding


fileVersion

public int fileVersion
The file version


e_type

public int e_type
The object file type


e_machine

public int e_machine
The machine type


e_version

public int e_version
The file object version


e_entry

public long e_entry
The entry point (virtual address)


e_phoff

public long e_phoff
Program Header Table's offset (bytes)


e_shoff

public long e_shoff
Section header table offset (bytes)


e_flags

public int e_flags
Processor-specific flags


e_ehsize

public int e_ehsize
The ELF header size (in bytes)


e_phentsize

public int e_phentsize
Program header table entry size


e_phnum

public int e_phnum
The number of Program header table entries


e_shentsize

public int e_shentsize
Section Header Entry size (bytes)


e_shnum

public int e_shnum
The number of Section headers


e_shstrndx

public int e_shstrndx
The string table index (in section header table)

Constructor Detail

ElfHeader

public ElfHeader()
Method Detail

read

public void read(ElfInputStream eis)
          throws java.io.IOException
This method fills in the ELF Header fields.

Parameters:
eis - The ElfInputStream for the ELF file.
Throws:
java.io.IOException - if an error is encountered in reading the Data Input Stream.

write

public void write(ElfOutputStream eos)
           throws java.io.IOException
This method writes out the ELF Header fields.

Parameters:
eos - The ElfOutputStream for the ELF file.
Throws:
java.io.IOException - if an error is encountered in writing the Data Output Stream.

toString

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

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