edu.d.umn.fileformats
Class DDFFileAbstract

java.lang.Object
  extended by edu.d.umn.fileformats.ElevationFile
      extended by edu.d.umn.fileformats.DDFFileAbstract
Direct Known Subclasses:
DDFFile, GZDDFFile

public abstract class DDFFileAbstract
extends ElevationFile

Provides basic methods to allow for tarballed DDF files or untarred DDF files.


Field Summary
protected  java.lang.String fileID
           
protected  int lengthOfFirstDirectoryElement
           
protected  int lengthOfLastDirectoryElement
           
protected  int lengthOfNextDirectoryElement
           
protected  int numDirectoryElements
           
protected  int startingPointOfDDA
           
 
Fields inherited from class edu.d.umn.fileformats.ElevationFile
elevations, fileName, filePath, groundCoordinates, maxElevation, minElevation, nColumns, nRows, quadrangleName, resolution
 
Constructor Summary
DDFFileAbstract()
          Creates a new instance of DDFFileAbstract
 
Method Summary
protected  int processElevations(java.io.InputStream reader)
           
protected  int processGroundCoordinates(java.io.InputStream reader)
          Searches through the iden file of the ddf records to get the north and west latitude and longitude.
protected  int processLeader(java.io.InputStream reader)
          Parses the contents of a data record leader.
protected  int processMinMaxElevation(java.io.InputStream reader)
          Searches through the ddom file of the ddf records to get the minimum and maximum elevation.
protected  int processRowColMax(java.io.InputStream reader)
          Searches the ldef file to find the number of rows and columns to expect for the elevation data.
 
Methods inherited from class edu.d.umn.fileformats.ElevationFile
getResolution
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numDirectoryElements

protected int numDirectoryElements

lengthOfFirstDirectoryElement

protected int lengthOfFirstDirectoryElement

lengthOfNextDirectoryElement

protected int lengthOfNextDirectoryElement

lengthOfLastDirectoryElement

protected int lengthOfLastDirectoryElement

startingPointOfDDA

protected int startingPointOfDDA

fileID

protected java.lang.String fileID
Constructor Detail

DDFFileAbstract

public DDFFileAbstract()
Creates a new instance of DDFFileAbstract

Method Detail

processLeader

protected int processLeader(java.io.InputStream reader)
                     throws java.io.IOException,
                            java.net.MalformedURLException
Parses the contents of a data record leader. This may or may not be the record leader for the file. Needed values are stored in the class variables, and the rest is discarded. This should position the reader at the first directory entry itself, which will usually be 0000;&ModuleName.

Parameters:
reader - The InputStream to work with.
Returns:
the number of bytes read.
Throws:
java.io.IOException
java.net.MalformedURLException

processGroundCoordinates

protected int processGroundCoordinates(java.io.InputStream reader)
                                throws java.io.IOException
Searches through the iden file of the ddf records to get the north and west latitude and longitude. Values are stored such that 46 degrees, 45 minutes and 0 seconds becomes 467,500.0 Since the USGS SDTS DEMs are 7.5 minute DEMs, the south and east coordinates are found by subtracting 1250 from the west and north coordinates

Returns:
The number of bytes read.
Throws:
java.io.IOException

processMinMaxElevation

protected int processMinMaxElevation(java.io.InputStream reader)
                              throws java.io.IOException
Searches through the ddom file of the ddf records to get the minimum and maximum elevation. Takes advantage of the fact that the values are immediately preceded by the keywords MIN or MAX, so we just look for those and then parse the set of integers that follows.

Returns:
The number of bytes read.
Throws:
java.io.IOException

processElevations

protected int processElevations(java.io.InputStream reader)
                         throws java.io.IOException
Throws:
java.io.IOException

processRowColMax

protected int processRowColMax(java.io.InputStream reader)
                        throws java.io.IOException
Searches the ldef file to find the number of rows and columns to expect for the elevation data. Assumes that the number of columns comes directly after the number of rows.

Returns:
The number of bytes read.
Throws:
java.io.IOException