org.deegree_impl.io.shpapi
Class FileHeader

java.lang.Object
  extended byorg.deegree_impl.io.shpapi.FileHeader

public class FileHeader
extends java.lang.Object

Class representing an ESRI Index File Header.

Uses class ByteUtils ShapeUtils modified from the original package com.bbn.openmap.layer.shape
Copyright (C) 1998 BBN Corporation 10 Moulton St. Cambridge, MA 02138

Last changes:
07.01.2000 ap: all methods copied from ShapeFileHeader
07.01.2000 ap: constructor renamed
16.08.2000 ap: method writeHeader(..) added

Version:
16.08.2000
Author:
Andreas Poth

Field Summary
private  long fileLength
           
private  SHPEnvelope fileMBR
           
private  int fileShapeType
           
private  int fileVersion
           
private  byte[] header
           
private  java.io.RandomAccessFile rafShp
           
 
Constructor Summary
FileHeader(java.io.RandomAccessFile rafShp_)
          Construct a IndexFileHeader from a file name.
 
Method Summary
 long getFileLength()
          method: getFileLength()
returns the length of the shape file in bytes
 SHPEnvelope getFileMBR()
          method: getFileMBR();
Returns the bounding box of this shape file.
 int getFileShapeType()
          method: getFileShapeType()
returns the code for the shape type of the file
 int getFileVersion()
          method: getFileVersion()
returns the version of the shape file
private  void initHeader()
          Reads the header of a Shape file.
private  void readHeader()
          Reads and parses the header of the file.
 void writeHeader()
          method: writeHeader()
Writes a blank header into the shape file.
 void writeHeader(int filelength, int shptype, SHPEnvelope mbr)
          method: writeHeader(int filelength, byte shptype,SHPEnvelope mbr)
Writes a header into the shape file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

header

private byte[] header

fileLength

private long fileLength

fileVersion

private int fileVersion

fileShapeType

private int fileShapeType

fileMBR

private SHPEnvelope fileMBR

rafShp

private java.io.RandomAccessFile rafShp
Constructor Detail

FileHeader

public FileHeader(java.io.RandomAccessFile rafShp_)
           throws java.io.IOException
Construct a IndexFileHeader from a file name.

Method Detail

getFileMBR

public SHPEnvelope getFileMBR()
method: getFileMBR();
Returns the bounding box of this shape file. The bounding box
is the smallest rectangle that encloses all the shapes in the
file.


getFileLength

public long getFileLength()
method: getFileLength()
returns the length of the shape file in bytes


getFileVersion

public int getFileVersion()
method: getFileVersion()
returns the version of the shape file


getFileShapeType

public int getFileShapeType()
method: getFileShapeType()
returns the code for the shape type of the file


initHeader

private void initHeader()
                 throws java.io.IOException
Reads the header of a Shape file. If the file
is empty, a blank header is written and then read. If the
file is not empty, the header is read.
After this function runs, the file pointer is set to byte 100,
the first byte of the first record in the file.

Throws:
java.io.IOException

writeHeader

public void writeHeader()
                 throws java.io.IOException
method: writeHeader()
Writes a blank header into the shape file.

Throws:
java.io.IOException

writeHeader

public void writeHeader(int filelength,
                        int shptype,
                        SHPEnvelope mbr)
                 throws java.io.IOException
method: writeHeader(int filelength, byte shptype,SHPEnvelope mbr)
Writes a header into the shape file.

Throws:
java.io.IOException

readHeader

private void readHeader()
                 throws java.io.IOException
Reads and parses the header of the file. Values from the header
are stored in the fields of this class.

Throws:
java.io.IOException