View Javadoc

1   // ELFOutput.java, created Mon Sep 23 19:30:25 2002 by joewhaley
2   // Copyright (C) 2001-3 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.Linker.ELF;
5   
6   import java.io.DataOutput;
7   import java.io.IOException;
8   
9   /***
10   *
11   * @author  John Whaley <jwhaley@alum.mit.edu>
12   * @version $Id: ELFOutput.java 2474 2006-12-24 07:54:24Z joewhaley $ 
13   */
14  public class ELFOutput extends ELFImpl {
15      
16      protected DataOutput out;
17      public ELFOutput(byte data, int type, int machine, int entry, DataOutput out) {
18          super(data, type, machine, entry);
19          this.out = out;
20      }
21      
22      public DataOutput getOutput() { return out; }
23      
24      public void write_byte(byte v) throws IOException {
25          out.writeByte(v);
26      }
27      
28      public void write_bytes(byte[] v) throws IOException {
29          out.write(v);
30      }
31      
32      public void write_half(int v) throws IOException {
33          out.writeShort((short)v);
34      }
35      
36      public void write_word(int v) throws IOException {
37          out.writeInt(v);
38      }
39      
40      public void write_sword(int v) throws IOException {
41          out.writeInt(v);
42      }
43      
44      public void write_off(int v) throws IOException {
45          out.writeInt(v);
46      }
47      
48      public void write_addr(int v) throws IOException {
49          out.writeInt(v);
50      }
51      
52      public void write_sectionname(String s) throws IOException {
53          int value;
54          if (section_header_string_table == null)
55              value = 0;
56          else
57              value = section_header_string_table.getStringIndex(s);
58          write_word(value);
59      }
60      
61      public void set_position(int offset) throws IOException { throw new IOException(); }
62      public byte read_byte() throws IOException { throw new IOException(); }
63      public void read_bytes(byte[] b) throws IOException { throw new IOException(); }
64      public int read_half() throws IOException { throw new IOException(); }
65      public int read_word() throws IOException { throw new IOException(); }
66      public int read_sword() throws IOException { throw new IOException(); }
67      public int read_off() throws IOException { throw new IOException(); }
68      public int read_addr() throws IOException { throw new IOException(); }
69  }