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

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

All Implemented Interfaces:
  DDFConstants

public class DDFModule
extends java.lang.Object
implements DDFConstants

The class that represents a ISO 8211 file.

Field Summary
`protected byte` `_appIndicator`
`protected java.lang.String` `_extendedCharSet`
`protected int` `_fieldAreaStart`
`protected int` `_fieldControlLength`
`protected byte` `_inlineCodeExtensionIndicator`
`protected byte` `_interchangeLevel`
`protected byte` `_leaderIden`
`protected int` `_recLength`
`protected int` `_sizeFieldLength`
`protected int` `_sizeFieldPos`
`protected int` `_sizeFieldTag`
`protected byte` `_versionNumber`
`protected java.lang.String` `fileName`
`protected BinaryFile` `fpDDF`
`protected long` `nFirstRecordOffset`
`protected java.util.Vector` `paoFieldDefns`
`protected DDFRecord` `poRecord`

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

Constructor Summary
`DDFModule()` The constructor.
`DDFModule(java.lang.String ddfName)`

Method Summary
`void` `close()` Close an ISO 8211 file.
`void` `destroy()` Clean up, get rid of data and close file pointer.
`java.lang.String` `dump()`
`DDFFieldDefinition` `findFieldDefn(java.lang.String pszFieldName)` Fetch the definition of the named field.
`DDFFieldDefinition` `getField(int i)` Fetch a field definition by index.
`BinaryFile` `open(java.lang.String pszFilename)` Open a ISO 8211 (DDF) file for reading, and read the DDR record to build the field definitions.
`int` `read()` Convenience method to read a byte from the data file.
`int` `read(byte[] toData, int offset, int length)` Method for other components to call to get the DDFModule to read bytes into the provided array.
`DDFRecord` `readRecord()` Read one record from the file, and return to the application.
`void` `reopen()`
`void` `rewind(long nOffset)` Return to first record.
`void` `seek(long pos)` Convenience method to seek to a location in the data file.
`java.lang.String` `toString()` Write out module info to debugging file.

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

Field Detail

### fpDDF

    protected BinaryFile fpDDF

### fileName

    protected java.lang.String fileName

### nFirstRecordOffset

    protected long nFirstRecordOffset

### _interchangeLevel

    protected byte _interchangeLevel

### _inlineCodeExtensionIndicator

    protected byte _inlineCodeExtensionIndicator

### _versionNumber

    protected byte _versionNumber

### _appIndicator

    protected byte _appIndicator

### _fieldControlLength

    protected int _fieldControlLength

### _extendedCharSet

    protected java.lang.String _extendedCharSet

### _recLength

    protected int _recLength

### _leaderIden

    protected byte _leaderIden

### _fieldAreaStart

    protected int _fieldAreaStart

### _sizeFieldLength

    protected int _sizeFieldLength

### _sizeFieldPos

    protected int _sizeFieldPos

### _sizeFieldTag

    protected int _sizeFieldTag

### paoFieldDefns

    protected java.util.Vector paoFieldDefns

### poRecord

    protected DDFRecord poRecord

Constructor Detail

### DDFModule

    public DDFModule()

  The constructor. Need to call open() if this constuctor is used.

### DDFModule

    public DDFModule(java.lang.String ddfName)
              throws java.io.IOException

Method Detail

### close

    public void close()

  Close an ISO 8211 file. Just close the file pointer to the file.

### destroy

    public void destroy()

  Clean up, get rid of data and close file pointer.

### open

    public BinaryFile open(java.lang.String pszFilename)
                    throws java.io.IOException

  Open a ISO 8211 (DDF) file for reading, and read the DDR record to build the field definitions. If the open succeeds the data descriptive record (DDR) will have been read, and all the field and subfield definitions will be available.

  Parameters:
    `pszFilename` - The name of the file to open.
  Throws:
    `java.io.IOException`

### toString

    public java.lang.String toString()

  Write out module info to debugging file. A variety of information about the module is written to the debugging file. This includes all the field and subfield definitions read from the header.

### dump

    public java.lang.String dump()

### findFieldDefn

    public DDFFieldDefinition findFieldDefn(java.lang.String pszFieldName)

  Fetch the definition of the named field. This function will scan the DDFFieldDefn's on this module, to find one with the indicated field name.

  Parameters:
    `pszFieldName` - The name of the field to search for. The comparison is case insensitive.
  Returns:
    A pointer to the request DDFFieldDefn object is returned, or null if none matching the name are found. The return object remains owned by the DDFModule, and should not be deleted by application code.

### readRecord

    public DDFRecord readRecord()

  Read one record from the file, and return to the application. The returned record is owned by the module, and is reused from call to call in order to preserve headers when they aren't being re-read from record to record.

  Returns:
    A pointer to a DDFRecord object is returned, or null if a read error, or end of file occurs. The returned record is owned by the module, and should not be deleted by the application. The record is only valid untill the next ReadRecord() at which point it is overwritten.

### read

    public int read(byte[] toData,
                    int offset,
                    int length)

  Method for other components to call to get the DDFModule to read bytes into the provided array.

  Parameters:
    `toData` - the bytes to put data into.
    `offset` - the byte offset to start reading from, whereever the pointer currently is.
    `length` - the number of bytes to read.
  Returns:
    the number of bytes read.

### read

    public int read()

  Convenience method to read a byte from the data file. Assumes that you know what you are doing based on the parameters read in the data file. For DDFFields that haven't loaded their subfields.

### seek

    public void seek(long pos)
              throws java.io.IOException

  Convenience method to seek to a location in the data file. Assumes that you know what you are doing based on the parameters read in the data file. For DDFFields that haven't loaded their subfields.

  Parameters:
    `pos` - the byte position to reposition the file pointer to.
  Throws:
    `java.io.IOException`

### getField

    public DDFFieldDefinition getField(int i)

  Fetch a field definition by index.

  Parameters:
    `i` - (from 0 to GetFieldCount() - 1.
  Returns:
    the returned field pointer or null if the index is out of range.

### rewind

    public void rewind(long nOffset)
                throws java.io.IOException

  Return to first record. The next call to ReadRecord() will read the first data record in the file.

  Parameters:
    `nOffset` - the offset in the file to return to. By default this is -1, a special value indicating that reading should return to the first data record. Otherwise it is an absolute byte offset in the file.
  Throws:
    `java.io.IOException`

### reopen

    public void reopen()

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