/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package usda.weru.util.gis;

import java.io.DataInputStream;
import java.io.IOException;

/**
 *
 * @author wjr
 */
public class DBFFileHeader {

    int version = 0;
    int updYr = 0;
    int updMo = 0;
    int updDa = 0;
    int hdrLen = 0;
    int recLen = 0;
    int numRec = 0;

	/**
	 *
	 * @return
	 */
	@Override
    public String toString() {
//        return fileCode + " " + fileLength + " " + version + " " + shapeType + " " + mbrMinX + " " + mbrMinY + " " + mbrMaxX + " " + mbrMaxY;
        return version + " " + updMo + "/" + updDa + "/" + (updYr%100) + " " +
                numRec + " " + hdrLen + " " + recLen;
    }

    void read(DataInputStream in) throws IOException {
        version = in.readByte();
        updYr = in.readByte();
        updMo = in.readByte();
        updDa = in.readByte();
        numRec = Swab.swab(in.readInt());
        hdrLen = Swab.swab(in.readShort());
        recLen = Swab.swab(in.readShort());
//        System.out.printf("%x %x %x\n", numRec, hdrLen, recLen);
        in.skipBytes(20);
//        fileCode = in.readInt();
    }
}