public class CdfReader
extends java.lang.Object
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 and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public CdfReader(Buf buf) throws java.io.IOException
buf
- buffer containing CDF filejava.io.IOException
public CdfReader(java.io.File file) throws java.io.IOException
file
- CDF filejava.io.IOException
public Buf getBuf()
public RecordFactory getRecordFactory()
public CdfDescriptorRecord getCdr()
public static boolean isMagic(byte[] intro)
intro
- byte array, at least 8 bytes if availableintro
are
a CDF magic number