|
JNISpice version 2.0.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectspice.basic.DAF
public class DAF
Class DAF supports creation of and low-level read operations on DAF files.
This class supports DAF segment descriptor list traversal and comment area access.
See the subclasses SPK
and
CK
for methods used to write those types of files.
Normal read access of SPK, CK, and binary PCK files
requires that these files be loaded via
KernelDatabase.load(java.lang.String)
. This method
plays the role of the routine FURNSH in SPICELIB.
The numerical results shown for this example may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, and the machine specific arithmetic implementation.
// // Example of DAF segment descriptor list traversal // import spice.basic.*; public class DAF_ex1 { // // Load the JNISpice shared object library before program execution. // static { System.loadLibrary( "JNISpice" ); } public static void main ( String[] args ) { try { // // Constants // final String TIMFMT = new String ( "YYYY MON DD HR:MN:SC.###### (TDB)::TDB" ); // // Local variables // boolean found; DAF d; double[] dc; int segno = 0; int[] ic; String bstr; String estr; // // Load a leapseconds kernel to support time conversion. // KernelDatabase.load ( "naif0009.tls" ); // // Create a DAF instance and open the DAF for // read access. We expect the name of the DAF // to be supplied on the command line. // if ( args.length == 0 ) { System.out.println ( "Usage: java DAF_ex1When executed on a PC/Linux/gcc/java 1.6.0_14 platform, the output from this program was (only partial output is shown):" ); return; } d = DAF.openForRead( args[0] ); // // Start a forward search through the segment list // of this DAF. // d.beginForwardSearch(); found = d.findNextArray(); while ( found ) { ++segno; // // Get integer portion of current array summary // (aka descriptor). // ic = d.getIntegerSummaryComponent(); dc = d.getDoubleSummaryComponent(); System.out.format ( "%n%nSegment%n%n", segno ); System.out.println ( "Body ID = " + ic[0] ); System.out.println ( "Center ID = " + ic[1] ); System.out.println ( "Frame ID = " + ic[2] ); System.out.println ( "Data Type = " + ic[3] ); System.out.println ( "Begin address = " + ic[4] ); System.out.println ( "End address = " + ic[5] ); bstr = CSPICE.timout ( dc[0], TIMFMT ); estr = CSPICE.timout ( dc[1], TIMFMT ); System.out.println ( "Start time = " + bstr ); System.out.println ( "Stop time = " + estr ); // // Find the next segment. // found = d.findNextArray(); } // // Close the DAF. // d.close(); } catch ( SpiceException exc ) { exc.printStackTrace(); } } }
Segment 1 Body ID = 1 Center ID = 0 Frame ID = 1 Data Type = 2 Begin address = 641 End address = 310404 Start time = 1899 JUL 29 00:00:00.000000 (TDB) Stop time = 2053 OCT 09 00:00:00.000000 (TDB) Segment 2 Body ID = 2 Center ID = 0 Frame ID = 1 Data Type = 2 Begin address = 310405 End address = 423048 Start time = 1899 JUL 29 00:00:00.000000 (TDB) Stop time = 2053 OCT 09 00:00:00.000000 (TDB) ... Segment 15 Body ID = 499 Center ID = 4 Frame ID = 1 Data Type = 2 Begin address = 2098633 End address = 2098644 Start time = 1899 JUL 29 00:00:00.000000 (TDB) Stop time = 2053 OCT 09 00:00:00.000000 (TDB)
Field Summary | |
---|---|
protected java.lang.String |
fileName
|
protected int |
handle
|
protected java.lang.String |
internalFileName
|
protected int |
ND
|
protected int |
NI
|
protected boolean |
readable
|
protected boolean |
writable
|
Constructor Summary | |
---|---|
DAF(java.lang.String fileName)
Construct a DAF instance representing a file. |
Method Summary | |
---|---|
void |
addComments(java.lang.String[] commentBuffer)
Add comments to an existing DAF. |
void |
beginBackwardSearch()
Begin backward search through segment list. |
void |
beginForwardSearch()
Begin forward search through segment list. |
void |
close()
Close a specified DAF, thereby freeing resources. |
int |
countSegments()
Count the segments in a DAF file. |
void |
deleteComments()
Delete comments from a DAF. |
boolean |
findNextArray()
Find the next array in the segment list. |
boolean |
findPreviousArray()
Find the previous array in the segment list. |
java.lang.String |
getArrayName()
Get the array name (also called the "segment identifier") (also called the "array name") for the current array (also called "segment"). |
double[] |
getDoubleSummaryComponent()
Get the double precision component of the array summary for the current segment. |
java.lang.String |
getFileName()
Return the file name. |
int |
getHandle()
Get file handle. |
int[] |
getIntegerSummaryComponent()
Get the integer component of the array summary for the current segment. |
java.lang.String |
getInternalFileName()
Get internal file name. |
int |
getND()
Get number of double precision summary components. |
int |
getNI()
Get number of integer summary components. |
boolean |
isReadable()
Indicate whether a DAF is readable. |
boolean |
isWritable()
Indicate whether a DAF is writable. |
static DAF |
openForRead(java.lang.String fileName)
Open a DAF for read access. |
static DAF |
openForWrite(java.lang.String fileName)
Open an existing DAF for write access. |
java.lang.String[] |
readComments(int lineLength)
Read comments from an existing DAF. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String fileName
protected int handle
protected java.lang.String internalFileName
protected int ND
protected int NI
protected boolean readable
protected boolean writable
Constructor Detail |
---|
public DAF(java.lang.String fileName)
Method Detail |
---|
public static DAF openForRead(java.lang.String fileName) throws SpiceException
SpiceException
public static DAF openForWrite(java.lang.String fileName) throws SpiceException
Note that a DAF cannot be opened for write access if it has already been opened for read access.
SpiceException
public int getHandle()
public java.lang.String getFileName()
public boolean isReadable()
A DAF is readable if it has been opened for read OR write access.
public boolean isWritable()
public int getNI()
public int getND()
public java.lang.String getInternalFileName() throws SpiceException
SpiceException
public void beginForwardSearch() throws SpiceException
SpiceException
public void beginBackwardSearch() throws SpiceException
SpiceException
public boolean findNextArray() throws SpiceException
This methods returns a "found" flag.
SpiceException
public boolean findPreviousArray() throws SpiceException
This methods returns a "found" flag.
SpiceException
public java.lang.String getArrayName() throws SpiceException
SpiceException
public double[] getDoubleSummaryComponent() throws SpiceException
SpiceException
public int[] getIntegerSummaryComponent() throws SpiceException
SpiceException
public void close() throws SpiceException
SpiceException
public void addComments(java.lang.String[] commentBuffer) throws SpiceException
SpiceException
public java.lang.String[] readComments(int lineLength) throws SpiceException
SpiceException
public void deleteComments() throws SpiceException
SpiceException
public int countSegments() throws SpiceException
SpiceException
|
JNISpice version 2.0.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |