# Class: com.pnfsoftware.jeb.core.units.codeobject.AbstractCodeObjectUnit

Convenient base class for code objects.

## Protected Constructor: AbstractCodeObjectUnit
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `formatType`, type: `java.lang.String`
- parameter: `name`, type: `java.lang.String`
- parameter: `unitProcessor`, type: `com.pnfsoftware.jeb.core.units.IUnitProcessor`
- parameter: `parent`, type: `com.pnfsoftware.jeb.core.IUnitCreator`
- parameter: `pdm`, type: `com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager`

Description: Create a code object unit.
parameter: input: input object
parameter: formatType: format type
parameter: name: unit name
parameter: unitProcessor: unit processor
parameter: parent: parent unit creator
parameter: pdm: property definition manager

## Protected Method: addAllSections
- parameter: `sections`, type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`

Description: Add section information entries.
parameter: sections: section information entries

## Protected Method: addAllSegments
- parameter: `segments`, type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`

Description: Add segment information entries.
parameter: segments: segment information entries

## Protected Method: addAllSymbols
- parameter: `symbols`, type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation>`

Description: Add symbol information entries.
parameter: symbols: symbol information entries

## Protected Method: addSection
- parameter: `section`, type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`

Description: Add section information.
parameter: section: section information

## Protected Method: addSegment
- parameter: `segment`, type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`

Description: Add segment information.
parameter: segment: segment information

## Protected Method: addSymbol
- parameter: `symbol`, type: `com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation`
- return type: `boolean`

Description: Add symbol information.
parameter: symbol: symbol information
return: true if the symbol was added

## Protected Method: applyRelocations
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `base`, type: `long`
- parameter: `linkInfoPrv`, type: `com.pnfsoftware.jeb.core.units.codeobject.ILinkInfoProvider`
- return type: `boolean`

Description: Relocate a mapped code object.
parameter: mem: virtual memory
parameter: base: mapping base address
parameter: linkInfoPrv: optional link information provider
return: true if relocations were applied

## Method: convertFileOffsetToRelativeAddress
- parameter: `offset`, type: `long`
- return type: `long`


## Method: convertRelativeAddressToFileOffset
- parameter: `rel`, type: `long`
- return type: `long`


## Protected Method: createSuitableMemory
- return type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`

Description: Create a virtual memory suitable to map this code object.
return: virtual memory object

## Method: getExportedSymbols
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation>`


## Method: getImportedSymbols
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation>`


## Method: getLoaderInformation
- return type: `com.pnfsoftware.jeb.core.units.codeobject.ILoaderInformation`


## Protected Method: getMappableInput
- return type: `com.pnfsoftware.jeb.core.input.IInput`

Description: Retrieve the input that is truly mappable. The default implementation simply returns [#getInput()](#getInput()), as is expected in most cases \(eg, ELF, PE\). For formats requiring pre\-processing of the input data, such as IHEX or other ascii\-encoded code objects, this method should be overridden.
return: mappable input

## Method: getRawMemoryMappedImage
- return type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`


## Method: getSection
- parameter: `i`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`


## Method: getSectionCount
- return type: `int`


## Method: getSections
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`


## Method: getSections
- parameter: `wflags`, type: `int`
- parameter: `bflags`, type: `int`
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`


## Method: getSegment
- parameter: `i`, type: `int`
- return type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`


## Method: getSegmentCount
- return type: `int`


## Method: getSegments
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`


## Method: getSegments
- parameter: `wflags`, type: `int`
- parameter: `bflags`, type: `int`
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`


## Method: getSymbolCount
- return type: `int`

Description: Get the number of symbols.
return: symbol count

## Method: getSymbols
- return type: `java.util.Collection<? extends com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation>`


## Method: getSymbols
- parameter: `mustHaveFlags`, type: `int`
- parameter: `mustNotHaveFlags`, type: `int`
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.codeobject.ISymbolInformation>`


## Method: getValidSections
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`


## Method: getValidSegments
- return type: `java.util.List<? extends com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation>`


## Protected Method: insertSection
- parameter: `index`, type: `int`
- parameter: `section`, type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`

Description: Insert section information.
parameter: index: insertion index
parameter: section: section information

## Protected Method: insertSegment
- parameter: `index`, type: `int`
- parameter: `segment`, type: `com.pnfsoftware.jeb.core.units.codeobject.ISegmentInformation`

Description: Insert segment information.
parameter: index: insertion index
parameter: segment: segment information

## Method: map
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `wantedBase`, type: `long`
- parameter: `applyRelocations`, type: `boolean`
- parameter: `linkInfoPrv`, type: `com.pnfsoftware.jeb.core.units.codeobject.ILinkInfoProvider`
- return type: `boolean`


## Protected Method: mapRawNoReloc
- parameter: `mem`, type: `com.pnfsoftware.jeb.core.units.code.asm.memory.IVirtualMemory`
- parameter: `base`, type: `long`
- return type: `boolean`

Description: Map the object's segments at the provided base without applying relocations.
parameter: mem: virtual memory object
parameter: base: mapping base address, or \-1 to use the preferred image base
return: the VM, null on error

## Protected Method: removeSection
- parameter: `index`, type: `int`

Description: Remove section information by index.
parameter: index: section index

## Protected Method: removeSegment
- parameter: `index`, type: `int`

Description: Remove segment information by index.
parameter: index: segment index

## Protected Method: setLoaderInformation
- parameter: `ldInfo`, type: `com.pnfsoftware.jeb.core.units.codeobject.ILoaderInformation`

Description: Set loader information.
parameter: ldInfo: loader information

## Protected Method: shouldAllocateFullImage
- return type: `boolean`

Description: Indicate whether the loader should allocate the full image range when preparing to load and map a code object file to memory. 

 Typically, the answer is yes for PE\-like files, no for ELF\-like files.
return: true if the full image range should be allocated

