java.lang.Object | ||
↳ | com.pnfsoftware.jeb.core.AbstractPlugin | |
↳ | com.pnfsoftware.jeb.core.units.AbstractUnitIdentifier |
Skeleton implementation for an IUnitIdentifier
class (aka, a Parser). It is recommended
parsers extend this class (or one of the its many subclasses) instead of implementing
IUnitIdentifier.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pnfsoftware.jeb.core.units.IUnitIdentifier
|
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
protected IPropertyDefinitionManager | pdm | ||||||||||
protected IPropertyManager | pm | ||||||||||
protected double | priority | ||||||||||
protected String | type |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AbstractUnitIdentifier(String type, double priority)
Create a new unit identifier.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
acceptAnyInputBytes()
The default implementation returns false.
| ||||||||||
static boolean |
checkBytes(byte[] data, int offset, byte... marker)
Convenience method used to check for expected bytes at a specific offset within the provided
data buffer.
| ||||||||||
static boolean | checkBytes(byte[] data, int offset, int... marker) | ||||||||||
static boolean | checkBytes(IInput input, int offset, int... marker) | ||||||||||
static boolean | checkBytes(IInput input, int offset, byte... marker) | ||||||||||
static boolean | checkBytes(IInput input, int offset, String header) | ||||||||||
String |
getFormatType()
Retrieve the identity of the unit type.
| ||||||||||
static byte[] |
getNonWhitespaceHeader(IInput input, int size, char... extraWhitespaceCharacters)
Returns the header with at least n significant bytes after the initial whitespace.
| ||||||||||
double |
getPriority()
Get the identifier priority.
| ||||||||||
IPropertyDefinitionManager |
getPropertyDefinitionManager()
Retrieve the property definition manager (PDM) used by this plugin.
| ||||||||||
ITypeIdProvider |
getTypeIdProvider()
The type-id provider for this type of units.
| ||||||||||
void |
initialize(IPropertyDefinitionManager parentPdm)
The default implementation creates a basic PDM attached to the provided parent.
| ||||||||||
static int |
readHeaderByte(IInput input, int offset)
Read a single header byte.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
final void | createPDM(IPropertyDefinitionManager parentPdm, String pdmDescription, int pdmFlags) | ||||||||||
static int | getTextFirstIndex(byte[] data, int i, char... extraWhitespaceCharacters) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.pnfsoftware.jeb.core.AbstractPlugin
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
com.pnfsoftware.jeb.core.IPlugin
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.IUnitIdentifier
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.IUnitPlugin
|
Create a new unit identifier.
type | mandatory type, which will be used as the sub-region type when the identifier is
initialized .
The type should be a valid region name, please see
PropertyDefinitionManager |
---|---|
priority | mandatory priority |
The default implementation returns false.
Convenience method used to check for expected bytes at a specific offset within the provided data buffer.
data | the input data buffer |
---|---|
offset | the offset |
marker | the bytes to check for |
header | converted to byte[] using encodeUTF8(String) |
---|
Retrieve the identity of the unit type. The type should be unique across all units.
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).
Get the identifier priority. Priority can be negative. Priorities are used by identifier
managers (eg, Processors
) to ensure that identifiers are called in a
(partially) predictable order, if need be. The higher the number, the higher the priority.
Recommendation: typical priority is zero. Relying on priority for proper identification should be used as a last resort measure.
Retrieve the property definition manager (PDM) used by this plugin.
The type-id provider for this type of units. Currently, This method is not intended to use by third-party clients.
The default implementation creates a basic PDM attached to the provided parent.
parentPdm | the parent PDM |
---|
Read a single header byte.
offset | offset within the getHeader() |
---|