Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.dataAccess.iso8211
Class DDFSubfieldDefinition

    java.lang.Object
      com.bbn.openmap.dataAccess.iso8211.DDFSubfieldDefinition

All Implemented Interfaces:
  DDFConstants

public class DDFSubfieldDefinition
extends java.lang.Object
implements DDFConstants

Information from the DDR record describing one subfield of a DDFFieldDefn. All subfields of a field will occur in each occurance of that field (as a DDFField) in a DDFRecord. Subfield's actually contain formatted data (as instances within a record).

Author:
  Guillaume Pelletier provided fix for Big Endian support (important for S-57)

Nested Class Summary
`static interface` | `DDFSubfieldDefinition.DDFBinaryFormat`

Field Summary
`protected boolean` | `bIsVariable` bIsVariable determines whether we using the chFormatDelimeter (true), or the fixed width (false).
`protected char` | `chFormatDelimeter`
`protected int` | `eBinaryFormat`
`protected DDFDataType` | `eType`
`protected int` | `nFormatWidth`
`protected java.lang.String` | `pszFormatString`
`protected java.lang.String` | `pszName`

Fields inherited from interface com.bbn.openmap.dataAccess.iso8211.DDFConstants
`DDF_FIELD_TERMINATOR, DDF_LEADER_SIZE, DDF_UNIT_TERMINATOR`

Constructor Summary
`DDFSubfieldDefinition()`

Method Summary
`java.lang.String` | `dumpData(byte[] pachData, int nMaxBytes)` Dump subfield value to debugging file.
`double` | `extractFloatData(byte[] pachSourceData, int nMaxBytes, MutableInt pnConsumedBytes)` Extract a subfield value as a float.
`int` | `extractIntData(byte[] pachSourceData, int nMaxBytes, MutableInt pnConsumedBytes)` Extract a subfield value as an integer.
`int` | `getDataLength(byte[] pachSourceData, int nMaxBytes, MutableInt pnConsumedBytes)` Scan for the end of variable length data.
`java.lang.String` | `getFormat()` Get pointer to subfield format string
`java.lang.String` | `getName()` Get pointer to subfield name.
`DDFDataType` | `getType()` Get the general type of the subfield.
`int` | `getWidth()`
`boolean` | `setFormat(java.lang.String pszFormat)` While interpreting the format string we don't support: Passing an explicit terminator for variable length field.
`void` | `setName(java.lang.String pszNewName)` Set the name of the subfield.
`java.lang.String` | `toString()` Write out subfield definition info.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### pszName

    protected java.lang.String pszName

### pszFormatString

    protected java.lang.String pszFormatString

### eType

    protected DDFDataType eType

### eBinaryFormat

    protected int eBinaryFormat

### bIsVariable

    protected boolean bIsVariable

  bIsVariable determines whether we using the chFormatDelimeter (true), or the fixed width (false).

### chFormatDelimeter

    protected char chFormatDelimeter

### nFormatWidth

    protected int nFormatWidth

Constructor Detail

### DDFSubfieldDefinition

    public DDFSubfieldDefinition()

Method Detail

### getWidth

    public int getWidth()

### getName

    public java.lang.String getName()

  Get pointer to subfield name.

### getFormat

    public java.lang.String getFormat()

  Get pointer to subfield format string

### getType

    public DDFDataType getType()

  Get the general type of the subfield. This can be used to determine which of ExtractFloatData(), ExtractIntData() or ExtractStringData() should be used.

  Returns:
    The subfield type. One of DDFInt, DDFFloat, DDFString or DDFBinaryString.

### setName

    public void setName(java.lang.String pszNewName)

  Set the name of the subfield.

### setFormat

    public boolean setFormat(java.lang.String pszFormat)

  While interpreting the format string we don't support:
  - Passing an explicit terminator for variable length field.
  - 'X' for unused data ... this should really be filtered
  - out by DDFFieldDefinition.applyFormats(), but isn't.
  - 'B' bitstrings that aren't a multiple of eight.

### toString

    public java.lang.String toString()

  Write out subfield definition info. A variety of information about this field definition is written to the give debugging file handle.

### getDataLength

    public int getDataLength(byte[] pachSourceData,
                             int nMaxBytes,
                             MutableInt pnConsumedBytes)

  Scan for the end of variable length data. Given a pointer to the data for this subfield (from within a DDFRecord) this method will return the number of bytes which are data for this subfield. The number of bytes consumed as part of this field can also be fetched. This number may be one longer than the length if there is a terminator character used.

  This method is mainly for internal use, or for applications which want the raw binary data to interpret themselves. Otherwise use one of ExtractStringData(), ExtractIntData() or ExtractFloatData().

  Parameters:
    `pachSourceData` - The pointer to the raw data for this field. This may have come from DDFRecord::GetData(), taking into account skip factors over previous subfields data.
    `nMaxBytes` - The maximum number of bytes that are accessable after pachSourceData.
    `pnConsumedBytes` - the number of bytes used.
  Returns:
    The number of bytes at pachSourceData which are actual data for this record (not including unit, or field terminator).

### extractFloatData

    public double extractFloatData(byte[] pachSourceData,
                                   int nMaxBytes,
                                   MutableInt pnConsumedBytes)

  Extract a subfield value as a float. Given a pointer to the data for this subfield (from within a DDFRecord) this method will return the floating point data for this subfield. The number of bytes consumed as part of this field can also be fetched. This method may be called for any type of subfield, and will return zero if the subfield is not numeric.

  Parameters:
    `pachSourceData` - The pointer to the raw data for this field. This may have come from DDFRecord::GetData(), taking into account skip factors over previous subfields data.
    `nMaxBytes` - The maximum number of bytes that are accessable after pachSourceData.
    `pnConsumedBytes` - Pointer to an integer into which the number of bytes consumed by this field should be written. May be null to ignore. This is used as a skip factor to increment pachSourceData to point to the next subfields data.
  Returns:
    The subfield's numeric value (or zero if it isn't numeric).

### extractIntData

    public int extractIntData(byte[] pachSourceData,
                              int nMaxBytes,
                              MutableInt pnConsumedBytes)

  Extract a subfield value as an integer. Given a pointer to the data for this subfield (from within a DDFRecord) this method will return the int data for this subfield. The number of bytes consumed as part of this field can also be fetched. This method may be called for any type of subfield, and will return zero if the subfield is not numeric.

  Parameters:
    `pachSourceData` - The pointer to the raw data for this field. This may have come from DDFRecord::GetData(), taking into account skip factors over previous subfields data.
    `nMaxBytes` - The maximum number of bytes that are accessable after pachSourceData.
    `pnConsumedBytes` - Pointer to an integer into which the number of bytes consumed by this field should be written. May be null to ignore. This is used as a skip factor to increment pachSourceData to point to the next subfields data.
  Returns:
    The subfield's numeric value (or zero if it isn't numeric).

### dumpData

    public java.lang.String dumpData(byte[] pachData,
                                     int nMaxBytes)

  Dump subfield value to debugging file.

  Parameters:
    `pachData` - Pointer to data for this subfield.
    `nMaxBytes` - Maximum number of bytes available in pachData.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details