|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.bristol.star.cdf.CdfReader
public class CdfReader
Examines a CDF file and provides methods to access its records.
Constructing an instance of this class reads enough of a file to identify it as a CDF and work out how to access its records. Most of the actual contents are only read from the data buffer as required. Although only the magic numbers and CDR are read during construction, in the case of a file-compressed CDF the whole thing is uncompressed, so it could still be an expensive operation.
For low-level access to the CDF internal records, use the
getCdr()
method to get the CdfDescriptorRecord and use that
in conjunction with knowledge of the internal format of CDF files
as a starting point to chase pointers around the file constructing
other records. When you have a pointer to another record, you can
use the record factory got from getRecordFactory()
to turn
it into a typed Record object.
Constructor Summary | |
---|---|
CdfReader(Buf buf)
Constructs a CdfReader from a buffer containing its byte data. |
|
CdfReader(java.io.File file)
Constructs a CdfReader from a readable file containing its byte data. |
Method Summary | |
---|---|
Buf |
getBuf()
Returns the buffer containing the uncompressed record stream for this reader's CDF file. |
CdfDescriptorRecord |
getCdr()
Returns the CDF Descriptor Record object for this reader's CDF. |
RecordFactory |
getRecordFactory()
Returns a RecordFactory that can be applied to this reader's Buf to construct CDF Record objects. |
static boolean |
isMagic(byte[] intro)
Examines a byte array to see if it looks like the start of a CDF file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CdfReader(Buf buf) throws java.io.IOException
buf
- buffer containing CDF file
java.io.IOException
public CdfReader(java.io.File file) throws java.io.IOException
file
- CDF file
java.io.IOException
Method Detail |
---|
public Buf getBuf()
public RecordFactory getRecordFactory()
public CdfDescriptorRecord getCdr()
public static boolean isMagic(byte[] intro)
intro
- byte array, at least 8 bytes if available
intro
are
a CDF magic number
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |