edu.iris.Fissures.seed.builder
Class SacExportBuilder

java.lang.Object
  extended by edu.iris.Fissures.seed.builder.ExportBuilder
      extended by edu.iris.Fissures.seed.builder.SacExportBuilder

public class SacExportBuilder
extends ExportBuilder

Concrete Builder class for exporting Blockette objects from the SeedObjectContainer to the SAC file format. Capable of single output stream or multi-file output.

Derived from code developed by:
Chris Laughbon
Doug Neuhauser
Allen Nance
Dennis O'Neill

Version:
11/5/2004
Author:
Robert Casey, IRIS DMC

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.iris.Fissures.seed.builder.ExportBuilder
ExportBuilder.LogicalRecord
 
Field Summary
 
Fields inherited from class edu.iris.Fissures.seed.builder.ExportBuilder
builderType, endOfGroup, endOfLogical, endOfPhysical, exportMold, exportScript, logicalPerPhysical, logicalRecord, logicalRecordCount, logicalRecordLength, logicalRecords, nestingDepth, nestingScore, outputStream, padEnabledFlag, penDown, physicalRecordLength, recordPadding, scriptCursor, scriptNesting, vaxOrder
 
Constructor Summary
SacExportBuilder()
          Create a new Sac Export Buider.
 
Method Summary
protected  boolean checkTrigger(java.lang.String s)
          Implement export script triggers here.
static Btime getEndTime(Btime startTime, int numSamples, int srFactor, int srMult)
          Get the end time (as a Btime object).
protected  void packToRecord()
          Convert SEED object info to SAC orientation.
protected  void padLogical()
          No function performed.
protected  void padPhysical()
          No function performed.
 void setDefaultMode()
          This String represents the script pattern for binary SAC volume.
 void setEncoding(java.lang.String s)
          Force data encoding of data records.
 void splitToFiles(boolean verboseFlag)
          Output to multiple SAC files.
protected  void startNewLogical(SeedObject obj, boolean continuation)
          Create a new logical/physical SAC record and add to logical record vector.
protected  void volumeFinish()
          Finish up volume export operations.
 
Methods inherited from class edu.iris.Fissures.seed.builder.ExportBuilder
build, close, finish, getNext, getType, isPaddingEnabled, open, push, setLogicalRecLen, setPaddingEnabled, setPhysicalRecLen, setVaxOrder, startVolume, writeRecord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SacExportBuilder

public SacExportBuilder()
Create a new Sac Export Buider.

Method Detail

setDefaultMode

public void setDefaultMode()
This String represents the script pattern for binary SAC volume. Each element is separated by a comma.

See Also:
ExportBuilder.getNext()

getEndTime

public static Btime getEndTime(Btime startTime,
                               int numSamples,
                               int srFactor,
                               int srMult)
                        throws java.lang.Exception
Get the end time (as a Btime object). Projected from the start time based on the number of samples and the calculated sample rate.

Throws:
java.lang.Exception

splitToFiles

public void splitToFiles(boolean verboseFlag)
                  throws java.lang.Exception
Output to multiple SAC files. Pipe the OutputStream assigned to this Builder through a filter that separates SAC header/data groups into separate output files. All files are written to local directory. Set the verbose flag to true to print file progress to stderr.

Throws:
java.lang.Exception

setEncoding

public void setEncoding(java.lang.String s)
Force data encoding of data records. Forces the encoding of the data records to be of this type, as typified by the assigned string -- see SeedEncodingResolver.java:encodingArray[] for encoding types.


padLogical

protected void padLogical()
No function performed. Overrides ExportBuilder method. SAC format does not need padding.

Overrides:
padLogical in class ExportBuilder

padPhysical

protected void padPhysical()
No function performed. Overrides ExportBuilder method. SAC format does not need padding.

Overrides:
padPhysical in class ExportBuilder

packToRecord

protected void packToRecord()
                     throws java.lang.Exception
Convert SEED object info to SAC orientation.

Specified by:
packToRecord in class ExportBuilder
Throws:
java.lang.Exception

checkTrigger

protected boolean checkTrigger(java.lang.String s)
                        throws java.lang.Exception
Implement export script triggers here.

Specified by:
checkTrigger in class ExportBuilder
Throws:
java.lang.Exception

volumeFinish

protected void volumeFinish()
                     throws BuilderException
Finish up volume export operations. We have finished the last SAC 'file', so truncate the data section to the last sample and write the final values to the header.

Specified by:
volumeFinish in class ExportBuilder
Throws:
BuilderException

startNewLogical

protected void startNewLogical(SeedObject obj,
                               boolean continuation)
                        throws java.lang.Exception
Create a new logical/physical SAC record and add to logical record vector. SeedObject will be ignored and should be set to null. Continuation will be false to build a record with SAC header, true for just data section.

Specified by:
startNewLogical in class ExportBuilder
Throws:
java.lang.Exception