- java.lang.Object
-
- spice.basic.DAS
-
- Direct Known Subclasses:
DLA
public class DAS extends java.lang.Object
Class DAS supports creation of and low-level read operations on DAS files.This class supports DAS comment area read access.
See the subclass
DSK
for methods used to write that type of file.Normal read access of DSK files requires that these files be loaded via
KernelDatabase.load(java.lang.String)
. This method plays the role of the routine FURNSH in SPICELIB.Examples
TBDThe 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.
Author_and_Version
Version 1.0.0 10-DEC-2016 (NJB)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
DAS.FileRecord
-
Constructor Summary
Constructors Modifier Constructor Description DAS()
No-args constructor.DAS(int handle)
Construct a DAS instance from handle of an open DAS file.protected
DAS(java.lang.String fileName)
Construct a DAS instance representing a file.The file need not exist.DAS(DAS das)
Copy constructor.This constructor creates a deep copy.
-
Method Summary
Modifier and Type Method Description void
addComments(java.lang.String[] commentBuffer)
Append comments to the comment area of a DAS file.private void
checkAccess()
Helper method for diagnosing improper file access.void
close()
Close a specified DAS file, thereby freeing resources.void
deleteComments()
Delete comments from a DAS file.int
getCommentCharacterCount()
Get the number of comment characters in a DAS file.int
getCommentRecordCount()
Get the number of comment records in a DAS file.java.lang.String
getFileName()
Return the file name.int
getHandle()
Get file handle.java.lang.String
getInternalFileName()
Get the internal file name from a DAS file.boolean
isReadable()
Indicate whether a DAS file is readable.boolean
isWritable()
Indicate whether a DAS file is writable.static DAS
openForRead(java.lang.String fileName)
Open a DAS file for write access.static DAS
openForWrite(java.lang.String fileName)
Open a DAS file for read access.java.lang.String[]
readComments(int lineLength)
Read comments from an existing DAS file.
-
-
-
Constructor Detail
-
DAS
protected DAS(java.lang.String fileName)
Construct a DAS instance representing a file.The file need not exist.User applications will not need to call this constructor directly. See the methods
openForRead(java.lang.String)
andopenForWrite(java.lang.String)
.- Parameters:
fileName
- String
-
DAS
public DAS(int handle) throws SpiceException
Construct a DAS instance from handle of an open DAS file.- Parameters:
handle
- int- Throws:
SpiceException
- exception
-
DAS
public DAS(DAS das)
Copy constructor.This constructor creates a deep copy.- Parameters:
das
- DAS
-
DAS
public DAS()
No-args constructor.
-
-
Method Detail
-
openForRead
public static DAS openForRead(java.lang.String fileName) throws SpiceException
Open a DAS file for write access.- Parameters:
fileName
- String- Returns:
- DAS
- Throws:
SpiceException
- exception
-
openForWrite
public static DAS openForWrite(java.lang.String fileName) throws SpiceException
Open a DAS file for read access.- Parameters:
fileName
- String- Returns:
- DAS
- Throws:
SpiceException
- exception
-
getHandle
public int getHandle() throws SpiceException
Get file handle.- Returns:
- int
- Throws:
SpiceException
- exception
-
getFileName
public java.lang.String getFileName() throws SpiceException
Return the file name.- Returns:
- String
- Throws:
SpiceException
- exception
-
isReadable
public boolean isReadable()
Indicate whether a DAS file is readable.A DAS file is readable if it has been opened for read OR write access.
- Returns:
- boolean
-
isWritable
public boolean isWritable()
Indicate whether a DAS file is writable.- Returns:
- boolean
-
close
public void close() throws SpiceException
Close a specified DAS file, thereby freeing resources.- Throws:
SpiceException
- exception
-
addComments
public void addComments(java.lang.String[] commentBuffer) throws SpiceException
Append comments to the comment area of a DAS file.- Parameters:
commentBuffer
- String[]- Throws:
SpiceException
- exception
-
deleteComments
public void deleteComments() throws SpiceException
Delete comments from a DAS file.- Throws:
SpiceException
- exception
-
readComments
public java.lang.String[] readComments(int lineLength) throws SpiceException
Read comments from an existing DAS file.- Parameters:
lineLength
- int- Returns:
- String[]
- Throws:
SpiceException
- exception
-
getInternalFileName
public java.lang.String getInternalFileName() throws SpiceException
Get the internal file name from a DAS file.This method initializes the internal file name field of the DAS instance and returns a deep copy of the name.
- Returns:
- String
- Throws:
SpiceException
- exception
-
getCommentRecordCount
public int getCommentRecordCount() throws SpiceException
Get the number of comment records in a DAS file.- Returns:
- int
- Throws:
SpiceException
- exception
-
getCommentCharacterCount
public int getCommentCharacterCount() throws SpiceException
Get the number of comment characters in a DAS file.- Returns:
- int
- Throws:
SpiceException
- exception
-
checkAccess
private void checkAccess() throws SpiceErrorException
Helper method for diagnosing improper file access. This method centralizes error handling for cases where access to a closed file is requested.- Throws:
SpiceErrorException
-
-