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 ;
62 Ehdr_p1(
final java.nio.ByteBuffer buf) {
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;
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); };
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.
final byte[] getBytesAt(int byteOffset, final byte[] v)
final ByteBuffer slice(final int byteOffset, final int byteLength)
Returns a slice of the current ByteBuffer starting at the specified byte offset and extending the spe...
final void setIntAt(final int byteOffset, final int v)
Puts a int at the specified byteOffset.
final void setBytesAt(int byteOffset, final byte[] v)
final ByteBuffer getBuffer()
final short getShortAt(final int byteOffset)
Retrieves the short at the specified byteOffset.
final void setShortAt(final int byteOffset, final short v)
Puts a short at the specified byteOffset.
final int getIntAt(final int byteOffset)
Retrieves the int at the specified byteOffset.
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]].