# Class: com.pnfsoftware.jeb.core.units.AbstractUnitIdentifier

Skeleton implementation for an [IUnitIdentifier](IUnitIdentifier) class \(aka, a Parser\). It is recommended parsers extend this class \(or one of the its many subclasses\) instead of implementing IUnitIdentifier.

## Protected Constructor: AbstractUnitIdentifier
- parameter: `type`, type: `java.lang.String`
- parameter: `priority`, type: `double`

Description: Create a new unit identifier.
parameter: type: mandatory type, which will be used as the sub\-region type when the identifier is            [initialized](AbstractUnitIdentifier#initialize(IPropertyDefinitionManager)).            The type should be a valid region name, please see            [PropertyDefinitionManager](PropertyDefinitionManager)
parameter: priority: mandatory priority

## Protected Field: pdm
Type: `com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager`
Description: Property definition manager.

## Protected Field: pm
Type: `com.pnfsoftware.jeb.core.properties.IPropertyManager`
Description: Property manager.

## Protected Field: priority
Type: `double`
Description: Identifier priority.

## Protected Field: type
Type: `java.lang.String`
Description: Unit format type.

## Method: acceptAnyInputBytes
- return type: `boolean`

Description: The default implementation returns false.

## Protected Method: createPDM
- parameter: `parentPdm`, type: `com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager`
- parameter: `pdmDescription`, type: `java.lang.String`
- parameter: `pdmFlags`, type: `int`

Description: Create and attach the property definition manager.
parameter: parentPdm: parent property definition manager
parameter: pdmDescription: optional PDM description
parameter: pdmFlags: PDM flags

## Method: getFormatType
- return type: `java.lang.String`


## Method: getPriority
- return type: `double`


## Method: getPropertyDefinitionManager
- return type: `com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager`


## Method: getTypeIdProvider
- return type: `com.pnfsoftware.jeb.util.serialization.ITypeIdProvider`


## Method: initialize
- parameter: `parentPdm`, type: `com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager`

Description: The default implementation creates a basic PDM attached to the provided parent.

## Static Method: checkBytes
- parameter: `data`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `marker`, type: `byte[]`
- return type: `boolean`

Description: Check for expected bytes at a specific offset within the provided data buffer.
parameter: data: the input data buffer
parameter: offset: the offset
parameter: marker: the bytes to check for
return: true if the bytes at `data[offset]` match the provided bytes
see also: AbstractUnitIdentifier#checkBytes(byte[], int, boolean, byte...)

## Static Method: checkBytes
- parameter: `data`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `caseSensitive`, type: `boolean`
- parameter: `marker`, type: `byte[]`
- return type: `boolean`

Description: Convenience method used to check for expected bytes at a specific offset within the provided data buffer.
parameter: data: the input data buffer
parameter: offset: the offset
parameter: caseSensitive: indicate if \[a\-z\] should be considered as case sensitive. While            insensitive case, marker must receive lower case characters. Default value is            TRUE.
parameter: marker: the bytes to check for
return: true if the bytes at &data\[offset\] are equals to the provided bytes

## Static Method: checkBytes
- parameter: `data`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `marker`, type: `int[]`
- return type: `boolean`

Description: Check for expected bytes at a specific offset within the provided data buffer.
parameter: data: the input data buffer
parameter: offset: the offset
parameter: marker: the byte values to check for
return: true if the bytes at `data[offset]` match the provided byte values
see also: AbstractUnitIdentifier#checkBytes(byte[], int, boolean, byte...)

## Static Method: checkBytes
- parameter: `data`, type: `byte[]`
- parameter: `offset`, type: `int`
- parameter: `caseSensitive`, type: `boolean`
- parameter: `marker`, type: `int[]`
- return type: `boolean`

Description: Check for expected bytes at a specific offset within the provided data buffer.
parameter: data: the input data buffer
parameter: offset: the offset
parameter: caseSensitive: true for case\-sensitive checks
parameter: marker: the byte values to check for
return: true if the bytes at `data[offset]` match the provided byte values
see also: AbstractUnitIdentifier#checkBytes(byte[], int, boolean, byte...)

## Static Method: checkBytes
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `offset`, type: `int`
- parameter: `marker`, type: `byte[]`
- return type: `boolean`

Description: Check for expected bytes at a specific offset within the provided input.
parameter: input: input data
parameter: offset: the offset
parameter: marker: the bytes to check for
return: true if the bytes at the offset match the provided bytes
see also: AbstractUnitIdentifier#checkBytes(byte[], int, boolean, byte...)

## Static Method: checkBytes
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `offset`, type: `int`
- parameter: `marker`, type: `int[]`
- return type: `boolean`

Description: Check for expected bytes at a specific offset within the provided input.
parameter: input: input data
parameter: offset: the offset
parameter: marker: the byte values to check for
return: true if the bytes at the offset match the provided byte values
see also: AbstractUnitIdentifier#checkBytes(byte[], int, boolean, byte...)

## Static Method: checkBytes
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `offset`, type: `int`
- parameter: `header`, type: `java.lang.String`
- return type: `boolean`

Description: Check for expected UTF\-8 text at a specific offset within the provided input.
parameter: input: input data
parameter: offset: the offset
parameter: header: converted to byte\[\] using [Strings#encodeUTF8(String)](Strings#encodeUTF8(String))
return: true if the bytes at the offset match the provided text
see also: AbstractUnitIdentifier#checkBytes(byte[], int, boolean, byte...)

## Static Method: getNonWhitespaceHeader
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `size`, type: `int`
- parameter: `extraWhitespaceCharacters`, type: `char[]`
- return type: `byte[]`

Description: Returns the header with at least n significant bytes after the initial whitespace. To be used for text documents which can potentially contain lot of whitespace characters before text. May return trimmed data \(when header is not enough\) or non\-trimmed data \(when header is enough\).
parameter: input: input data
parameter: size: minimum data size required
parameter: extraWhitespaceCharacters: additional characters considered as whitespace
return: a byte array, possibly smaller than requested, or null on error

## Static Method: getNonWhitespaceHeader
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `size`, type: `int`
- parameter: `trim`, type: `boolean`
- parameter: `extraWhitespaceCharacters`, type: `char[]`
- return type: `byte[]`

Description: Returns the header with at least n significant bytes after the initial whitespace. To be used for text documents which can potentially contain lot of whitespace characters before text.
parameter: input: [IInput](IInput)
parameter: size: minimum data size required
parameter: trim: when true, any BOM \+ any whitespace will be skipped
parameter: extraWhitespaceCharacters: additional characters considered as whitespace
return: an array with at least minimum size. If there is not enough available bytes, the         array size will be smaller. May return null in case of error or when file only         contains whitespaces.

## Protected Static Method: getTextFirstIndex
- parameter: `data`, type: `byte[]`
- parameter: `i`, type: `int`
- parameter: `extraWhitespaceCharacters`, type: `char[]`
- return type: `int`

Description: Retrieve the index of the first non\-whitespace text byte.
parameter: data: input bytes
parameter: i: start index
parameter: extraWhitespaceCharacters: additional characters considered as whitespace
return: the first non\-whitespace byte index, or `data.length`

## Static Method: readHeaderByte
- parameter: `input`, type: `com.pnfsoftware.jeb.core.input.IInput`
- parameter: `offset`, type: `int`
- return type: `int`

Description: Read a single header byte.
parameter: input: input data
parameter: offset: offset within the [IInput#getHeader()](IInput#getHeader())
return: the byte value, \-1 on error \(eg, the offset is outside the header\)

