Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Linker.ELF
Class ELFOutput  view ELFOutput download ELFOutput.java

java.lang.Object
  extended byLinker.ELF.ELFImpl
      extended byLinker.ELF.ELFOutput
All Implemented Interfaces:
ELF, ELFConstants

public class ELFOutput
extends ELFImpl

Version:
$Id: ELFOutput.java,v 1.4 2003/05/08 19:49:13 joewhaley Exp $

Field Summary
protected  int e_entry
           
protected  int e_flags
           
protected  int e_machine
           
protected  int e_type
           
protected  int e_version
           
protected  byte ei_class
           
protected  byte ei_data
           
protected  java.io.DataOutput out
           
protected  java.util.List program_headers
           
protected  Section.StrTabSection section_header_string_table
           
protected  java.util.List sections
           
 
Fields inherited from interface Linker.ELF.ELFConstants
ELFCLASS32, ELFCLASS64, ELFCLASSNONE, ELFDATA2LSB, ELFDATA2MSB, ELFDATANONE, ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, EM_386, EM_68K, EM_860, EM_88K, EM_M32, EM_MIPS, EM_MIPS_RS4_BE, EM_SPARC, ET_CORE, ET_DYN, ET_EXEC, ET_HIPROC, ET_LOPROC, ET_NONE, ET_REL, EV_CURRENT, EV_NONE, PT_DYNAMIC, PT_HIPROC, PT_INTERP, PT_LOAD, PT_LOPROC, PT_NOTE, PT_NULL, PT_PHDR, PT_SHLIB, R_386_32, R_386_NONE, R_386_PC32, SHF_ALLOC, SHF_EXECINSTR, SHF_MASKPROC, SHF_WRITE, SHN_ABS, SHN_COMMON, SHN_HIPROC, SHN_HIRESERVE, SHN_INVALID, SHN_LOPROC, SHN_LORESERVE, SHN_UNDEF, SHT_DYNAMIC, SHT_DYNSYM, SHT_HASH, SHT_HIPROC, SHT_HIUSER, SHT_LOPROC, SHT_LOUSER, SHT_NOBITS, SHT_NOTE, SHT_NULL, SHT_PROGBITS, SHT_REL, SHT_RELA, SHT_SHLIB, SHT_STRTAB, SHT_SYMTAB, STB_GLOBAL, STB_HIPROC, STB_LOCAL, STB_LOPROC, STB_WEAK, STT_FILE, STT_FUNC, STT_HIPROC, STT_LOPROC, STT_NOTYPE, STT_OBJECT, STT_SECTION
 
Constructor Summary
ELFOutput(byte data, int type, int machine, int entry, java.io.DataOutput out)
           
 
Method Summary
 void addProgramHeader(ProgramHeader p)
          Adds the given ELF program header to this object.
 void addSection(Section s)
          Adds the given ELF section to this object.
static int getHeaderSize()
           
 java.io.DataOutput getOutput()
           
 Section getSection(int i)
           
 Section.StrTabSection getSectionHeaderStringTable()
          Returns the section header string table, if one has been defined.
 int getSectionIndex(Section s)
           
 java.util.List getSections()
          Returns the list of ELF sections in this object.
 boolean isBigEndian()
          Returns true if this ELF object is big-endian.
 boolean isLittleEndian()
          Returns true if this ELF object is little-endian.
 int read_addr()
           
 byte read_byte()
           
 void read_bytes(byte[] b)
           
 int read_half()
           
 int read_off()
           
 int read_sword()
           
 int read_word()
           
 void removeProgramHeader(ProgramHeader p)
          Removes the given ELF program header from this object.
 void removeSection(Section s)
          Removes the given ELF section from this object.
 void set_position(int offset)
           
 void setBigEndian()
           
 void setLittleEndian()
           
 void setSectionHeaderStringTable(Section.StrTabSection shstrtab)
          Sets the section header string table to be the given section.
 void write_addr(int v)
           
 void write_byte(byte v)
           
 void write_bytes(byte[] v)
           
 void write_half(int v)
           
 void write_off(int v)
           
 void write_sectionname(java.lang.String s)
           
 void write_sword(int v)
           
 void write_word(int v)
           
 void write()
           
(package private)  void writeHeader(int e_phoff, int e_shoff)
           
(package private)  void writeIdent()
           
(package private)  void writeMagicNumber()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

protected java.io.DataOutput out

ei_class

protected byte ei_class

ei_data

protected byte ei_data

e_type

protected int e_type

e_machine

protected int e_machine

e_version

protected int e_version

e_entry

protected int e_entry

e_flags

protected int e_flags

program_headers

protected java.util.List program_headers

sections

protected java.util.List sections

section_header_string_table

protected Section.StrTabSection section_header_string_table
Constructor Detail

ELFOutput

public ELFOutput(byte data,
                 int type,
                 int machine,
                 int entry,
                 java.io.DataOutput out)
Method Detail

getOutput

public java.io.DataOutput getOutput()

write_byte

public void write_byte(byte v)
                throws java.io.IOException

write_bytes

public void write_bytes(byte[] v)
                 throws java.io.IOException

write_half

public void write_half(int v)
                throws java.io.IOException

write_word

public void write_word(int v)
                throws java.io.IOException

write_sword

public void write_sword(int v)
                 throws java.io.IOException

write_off

public void write_off(int v)
               throws java.io.IOException

write_addr

public void write_addr(int v)
                throws java.io.IOException

write_sectionname

public void write_sectionname(java.lang.String s)
                       throws java.io.IOException

set_position

public void set_position(int offset)
                  throws java.io.IOException

read_byte

public byte read_byte()
               throws java.io.IOException

read_bytes

public void read_bytes(byte[] b)
                throws java.io.IOException

read_half

public int read_half()
              throws java.io.IOException

read_word

public int read_word()
              throws java.io.IOException

read_sword

public int read_sword()
               throws java.io.IOException

read_off

public int read_off()
             throws java.io.IOException

read_addr

public int read_addr()
              throws java.io.IOException

getSectionHeaderStringTable

public Section.StrTabSection getSectionHeaderStringTable()
Description copied from interface: ELF
Returns the section header string table, if one has been defined. Or null otherwise.

Specified by:
getSectionHeaderStringTable in interface ELF

setSectionHeaderStringTable

public void setSectionHeaderStringTable(Section.StrTabSection shstrtab)
Description copied from interface: ELF
Sets the section header string table to be the given section.

Specified by:
setSectionHeaderStringTable in interface ELF

getSectionIndex

public int getSectionIndex(Section s)

getSection

public Section getSection(int i)
Specified by:
getSection in interface ELF

getSections

public java.util.List getSections()
Description copied from interface: ELF
Returns the list of ELF sections in this object.

Specified by:
getSections in interface ELF

addSection

public void addSection(Section s)
Description copied from interface: ELF
Adds the given ELF section to this object.

Specified by:
addSection in interface ELF

removeSection

public void removeSection(Section s)
Description copied from interface: ELF
Removes the given ELF section from this object.

Specified by:
removeSection in interface ELF

addProgramHeader

public void addProgramHeader(ProgramHeader p)
Description copied from interface: ELF
Adds the given ELF program header to this object.

Specified by:
addProgramHeader in interface ELF

removeProgramHeader

public void removeProgramHeader(ProgramHeader p)
Description copied from interface: ELF
Removes the given ELF program header from this object.

Specified by:
removeProgramHeader in interface ELF

isLittleEndian

public boolean isLittleEndian()
Description copied from interface: ELF
Returns true if this ELF object is little-endian.

Specified by:
isLittleEndian in interface ELF

isBigEndian

public boolean isBigEndian()
Description copied from interface: ELF
Returns true if this ELF object is big-endian.

Specified by:
isBigEndian in interface ELF

setLittleEndian

public void setLittleEndian()
Specified by:
setLittleEndian in interface ELF

setBigEndian

public void setBigEndian()
Specified by:
setBigEndian in interface ELF

write

public void write()
           throws java.io.IOException
Specified by:
write in interface ELF

writeHeader

void writeHeader(int e_phoff,
                 int e_shoff)
           throws java.io.IOException

writeIdent

void writeIdent()
          throws java.io.IOException

writeMagicNumber

void writeMagicNumber()
                throws java.io.IOException

getHeaderSize

public static int getHeaderSize()