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 DDFField

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

public class DDFField
extends java.lang.Object

This object represents one field in a DDFRecord. This models an instance of the fields data, rather than it's data definition which is handled by the DDFFieldDefn class. Note that a DDFField doesn't have DDFSubfield children as you would expect. To extract subfield values use GetSubfieldData() to find the right data pointer and then use ExtractIntData(), ExtractFloatData() or ExtractStringData().

Field Summary
`protected int` | `dataLength`
`protected int` | `dataPosition`
`protected int` | `headerOffset`
`protected byte[]` | `pachData`
`protected DDFFieldDefinition` | `poDefn`
`protected java.util.Hashtable` | `subfields`

Constructor Summary
`DDFField()`
`DDFField(DDFFieldDefinition poDefnIn, byte[] pachDataIn)`
`DDFField(DDFFieldDefinition poDefnIn, byte[] pachDataIn, boolean doSubfields)`
`DDFField(DDFFieldDefinition poDefnIn, int dataPositionIn, int dataLengthIn)`

Method Summary
`protected void` | `addSubfield(DDFSubfield ddfs)`
`void` | `buildSubfields()`
`byte[]` | `getData()` Return the pointer to the entire data block for this record.
`int` | `getDataLength()` If getData() returns null, it'll be your responsibilty to go after the data you need for this field.
`int` | `getDataPosition()` If getData() returns null, it'll be your responsibilty to go after the data you need for this field.
`int` | `getDataSize()` Return the number of bytes in the data block returned by GetData().
`DDFFieldDefinition` | `getFieldDefn()` Fetch the corresponding DDFFieldDefn.
`int` | `getHeaderOffset()` Get how many bytes to add to the data position for absolute position in the data file for the field data.
`int` | `getRepeatCount()` How many times do the subfields of this record repeat? This will always be one for non-repeating fields.
`DDFSubfield` | `getSubfield(java.lang.String subfieldName)` Will return a DDFSubfield object with the given name, or the first one off the list for a repeating subfield.
`byte[]` | `getSubfieldData(DDFSubfieldDefinition poSFDefn, MutableInt pnMaxBytes, int iSubfieldIndex)` Fetch raw data pointer for a particular subfield of this field.
`java.util.List` | `getSubfields(java.lang.String subfieldName)` Will return an ordered list of DDFSubfield objects.
`void` | `initialize(DDFFieldDefinition poDefnIn, byte[] pachDataIn)`
`protected void` | `setHeaderOffset(int headerOffsetIn)` Set how many bytes to add to the data position for absolute position in the data file for the field data.
`java.lang.String` | `toString()` Creates a string with variety of information about this field, and all it's subfields is written to the given debugging file handle.

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

Field Detail

### poDefn

    protected DDFFieldDefinition poDefn

### pachData

    protected byte[] pachData

### subfields

    protected java.util.Hashtable subfields

### dataPosition

    protected int dataPosition

### dataLength

    protected int dataLength

### headerOffset

    protected int headerOffset

Constructor Detail

### DDFField

    public DDFField()

### DDFField

    public DDFField(DDFFieldDefinition poDefnIn,
                    int dataPositionIn,
                    int dataLengthIn)

### DDFField

    public DDFField(DDFFieldDefinition poDefnIn,
                    byte[] pachDataIn)

### DDFField

    public DDFField(DDFFieldDefinition poDefnIn,
                    byte[] pachDataIn,
                    boolean doSubfields)

Method Detail

### initialize

    public void initialize(DDFFieldDefinition poDefnIn,
                           byte[] pachDataIn)

### setHeaderOffset

    protected void setHeaderOffset(int headerOffsetIn)

  Set how many bytes to add to the data position for absolute position in the data file for the field data.

### getHeaderOffset

    public int getHeaderOffset()

  Get how many bytes to add to the data position for absolute position in the data file for the field data.

### getData

    public byte[] getData()

  Return the pointer to the entire data block for this record. This is an internal copy, and shouldn't be freed by the application. If null, then check the dataPosition and daataLength for byte offsets for the data in the file, and go get it yourself. This is done for really large files where it doesn't make sense to load the data.

### getDataSize

    public int getDataSize()

  Return the number of bytes in the data block returned by GetData().

### getFieldDefn

    public DDFFieldDefinition getFieldDefn()

  Fetch the corresponding DDFFieldDefn.

### getDataPosition

    public int getDataPosition()

  If getData() returns null, it'll be your responsibilty to go after the data you need for this field.

  Returns:
    the byte offset into the source file to start reading this field.

### getDataLength

    public int getDataLength()

  If getData() returns null, it'll be your responsibilty to go after the data you need for this field.

  Returns:
    the number of bytes contained in the source file for this field.

### toString

    public java.lang.String toString()

  Creates a string with variety of information about this field, and all it's subfields is written to the given debugging file handle. Note that field definition information (ala DDFFieldDefn) isn't written.

  Returns:
    String containing info.

### getSubfields

    public java.util.List getSubfields(java.lang.String subfieldName)

  Will return an ordered list of DDFSubfield objects. If the subfield wasn't repeated, it will provide a list containing one object. Will return null if the subfield doesn't exist.

### getSubfield

    public DDFSubfield getSubfield(java.lang.String subfieldName)

  Will return a DDFSubfield object with the given name, or the first one off the list for a repeating subfield. Will return null if the subfield doesn't exist.

### getSubfieldData

    public byte[] getSubfieldData(DDFSubfieldDefinition poSFDefn,
                                  MutableInt pnMaxBytes,
                                  int iSubfieldIndex)

  Fetch raw data pointer for a particular subfield of this field. The passed DDFSubfieldDefn (poSFDefn) should be acquired from the DDFFieldDefn corresponding with this field. This is normally done once before reading any records. This method involves a series of calls to DDFSubfield::GetDataLength() in order to track through the DDFField data to that belonging to the requested subfield. This can be relatively expensive.

  Parameters:
    `poSFDefn` - The definition of the subfield for which the raw data pointer is desired.
    `pnMaxBytes` - The maximum number of bytes that can be accessed from the returned data pointer is placed in this int, unless it is null.
    `iSubfieldIndex` - The instance of this subfield to fetch. Use zero (the default) for the first instance.
  Returns:
    A pointer into the DDFField's data that belongs to the subfield. This returned pointer is invalidated by the next record read (DDFRecord::ReadRecord()) and the returned pointer should not be freed by the application.

### buildSubfields

    public void buildSubfields()

### addSubfield

    protected void addSubfield(DDFSubfield ddfs)

### getRepeatCount

    public int getRepeatCount()

  How many times do the subfields of this record repeat? This will always be one for non-repeating fields.

  Returns:
    The number of times that the subfields of this record occur in this record. This will be one for non-repeating fields.

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