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

A simple PE/PE64 parser \(not relying on the [IUnit](IUnit) interface\) that may be used for convenience purposes.

## Constructor: PEParser
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`


## Method: add
- parameter: `address`, type: `long`
- parameter: `size`, type: `long`
- return type: `long`

Description: Add an address \(unsigned\) to a size \(unsigned\) and return a sanitized address. 

 Theoretically, this method should be used throughout the processing of various areas, eg imports, exports, etc. however, sanitizations are costly and clutter the code. Therefore, we limit them to filters before starting processing. Processing of a an area of the PE are wrapped in try\-catch to avoid killing processing of the entire PE, should an error \(eg, due to malformed structures\) arise. This has the drawback of semi\-neutering \(only semi, because the exceptions are displayed and silently reported\) parsing bugs that may be present.
parameter: address: 
parameter: size: 
return: 

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


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


## Method: getCOFFHeader
- return type: `com.pnfsoftware.jeb.core.units.codeobject.ICOFFHeader`


## Method: getPEOptionalHeader
- return type: `com.pnfsoftware.jeb.core.units.codeobject.IPEOptionalHeader`


## Method: getSectionHeaders
- return type: `com.pnfsoftware.jeb.core.units.codeobject.ICOFFSectionHeader[]`


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


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


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


## Method: isAddressInside
- parameter: `a`, type: `long`
- return type: `boolean`

Description: Determine if a legal address is within the bounds of the mapped PE file.
parameter: a: 
return: 

## Method: sanitizeAddress
- parameter: `address`, type: `long`
- return type: `long`

Description: Sanitize a long to a legal address rel. to the PE specifications \(32\-bit or 64\-bit space\).
parameter: address: 
return: 

