26package org.jau.sys.elf;
28import java.nio.ByteBuffer;
30import org.jau.io.Buffers;
31import org.jau.io.StructAccessor;
40 private static final int Ehdr_p1_size = 24 ;
41 private static final int e_ident_offset = 0 ;
43 private static final int e_type_offset = 16 ;
45 private static final int e_machine_offset = 18 ;
47 private static final int e_version_offset = 20 ;
58 public static Ehdr_p1
create(
final java.nio.ByteBuffer buf) {
59 return new Ehdr_p1(buf);
62 Ehdr_p1(
final java.nio.ByteBuffer buf) {
68 return accessor.getBuffer();
77 public Ehdr_p1
setE_ident(
final int offset,
final byte[] val) {
78 final int arrayLength = 16;
79 if( offset + val.length > arrayLength ) {
throw new IndexOutOfBoundsException(
"offset "+offset+
" + val.length "+val.length+
" > array-length "+arrayLength); };
82 final int bTotal = arrayLength * elemSize;
84 int bOffset = e_ident_offset;
85 final int bLimes = bOffset + bTotal;
86 if( bLimes > destB.limit() ) {
throw new IndexOutOfBoundsException(
"bLimes "+bLimes+
" > buffer.limit "+destB.limit()+
", elemOff "+bOffset+
", elemSize "+elemSize+
" * "+arrayLength); };
87 bOffset += elemSize * offset;
88 accessor.setBytesAt(bOffset, val);
98 public byte[]
getE_ident(
final int offset,
final byte result[]) {
99 final int arrayLength = 16;
100 if( offset + result.length > arrayLength ) {
throw new IndexOutOfBoundsException(
"offset "+offset+
" + result.length "+result.length+
" > array-length "+arrayLength); };
107 accessor.setShortAt(e_type_offset, val);
113 return accessor.getShortAt(e_type_offset);
118 accessor.setShortAt(e_machine_offset, val);
124 return accessor.getShortAt(e_machine_offset);
129 accessor.setIntAt(e_version_offset, val);
135 return accessor.getIntAt(e_version_offset);
Utility methods allowing easy java.nio.Buffer manipulations.
static final int SIZEOF_BYTE
static ByteBuffer newDirectByteBuffer(final int size)
Allocates a new direct ByteBuffer with the specified number of elements.
Ehdr_p1 setE_version(final int val)
Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
java.nio.ByteBuffer getBuffer()
ByteBuffer getE_ident()
Getter for native field: CType['char *', size [fixed false, lnx64 16], [array*1]],...
static final int getE_identArrayLength()
Getter for native field: CType['char *', size [fixed false, lnx64 16], [array*1]],...
byte[] getE_ident(final int offset, final byte result[])
Getter for native field: CType['char *', size [fixed false, lnx64 16], [array*1]],...
short getE_type()
Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Ehdr_p1 setE_type(final short val)
Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
static Ehdr_p1 create(final java.nio.ByteBuffer buf)
int getE_version()
Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
Ehdr_p1 setE_ident(final int offset, final byte[] val)
Setter for native field: CType['char *', size [fixed false, lnx64 16], [array*1]],...
Ehdr_p1 setE_machine(final short val)
Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
short getE_machine()
Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].