/* JRG, the Resource Geology Seismic Processing System for Java, and Viewmat for Java are Copyright 1998-2000 by John N. Louie The software and methods here are the subject of academic research, not commercial products. I would like to know what use you make of my methods, and have your feedback on their success or failure. Also, by letting me know who you are, I can inform you if bugs or errors are discovered. Please send me an email message with: your name and email address; whether you are a student or faculty member, consultant or employee; the name of your university or company, and department; and a sentence or two describing what use you intend to make of these methods. Send your message to louie@seismo.unr.edu */ import java.io.*; public class OldRGFileHead { public int ntrace; /* no. of traces in file */ public int nt; /* no. of samples per trace */ public float starttime; /* time after source initiation of 1st sample, seconds */ static final int OLDRGFILEHEADBYTES = 12; /* Constructor */ public OldRGFileHead() { starttime = 0F; } /* Construct a copy from an RgFileHead */ public OldRGFileHead(RgFileHead fhd) { ntrace = fhd.ntrace; nt = fhd.nt; starttime = fhd.starttime; } public String toString() { return "ntrace=" + ntrace + " nt=" + nt + " starttime=" + Viewmat.getSignif("" + starttime); } public void readOldRGFileHead(String name) { FileInputStream fis = null; BufferedInputStream bis = null; DataInputStream dis = null; System.out.println("readOldRGFileHead: reading header from file " + name + " ... "); try {fis = new FileInputStream(name); } catch(FileNotFoundException fnf) { System.out.println(fnf.toString()); return; } bis = new BufferedInputStream(fis); dis = new DataInputStream(bis); try {read(dis); } catch(IOException ioe) { System.out.println("Could not read RG header from file " + name); return; } try {fis.close(); } catch(IOException ioe) { System.out.println(ioe.toString()); return; } System.out.println("readOldRGFileHead done."); } public void read(DataInputStream dis) throws IOException { ntrace = dis.readInt(); nt = dis.readInt(); starttime = dis.readFloat(); } public void write(DataOutputStream dos) throws IOException { dos.writeInt(ntrace); dos.writeInt(nt); dos.writeFloat(starttime); } }