set file [new HeaderFile]
$file open <filename> <mode> <permissions>Open the file specified by
filename for reading or writing. The mode and permissions fields are identical to the Tcl open command. Both mode and permissions are optional and default to "r" and 0644 respectively.
Returns: Nothing. close:
$file closeClose the currently opened archive file. If no file is open, does nothing.
Returns: Nothing. isopened:
set flag [$file isopened]Query the open status of the
HeaderFile object.
Returns: true if a file is currently open, false if no file is open.
filename:
set filename [$file filename]Query the name of the currently open file.
Returns: the name of the currently open file (if there is an open file), otherwise returns an empty string. write_sdp:
$file write_sdp $sdpWrite an SDP announcement to the header file.
sdp is a standard SDP announcement. Write a block of text to the header file in the following format:
START_SDP
$sdp
END_SDP
This method may be invoked only if the file is opened in write mode.
Returns: Nothing. write_stream:
$file write_stream <id> <session> <datafile> <indexfile>This method should be invoked when a new stream is detected in the recorder. It writes a block of text to the header file in the following format:
START_STREAM
id=<id>
session=<session>
datafile=<datafile>
indexfile=<indexfile>
END_STREAM
id is a unique identifier for this stream within the header file. It may be any unique string of characters. session is a string of characters used to identify the session which this stream belongs to. All streams that are part of the same session must have the same session string. datafile and indexfile are the names of the data and index files associated with this stream. If the filenames are relative paths, they are assumed to be relative to the location of the header file.
This method may be invoked only if the file is opened in write mode.
Returns: Nothing. read:
$file readRead the entire header file into internal data structures. This method may be invoked only if the file is opened in read mode. Once this method has been invoked, the programmer can use any of the
info method to query the internal data structures.
Returns: Nothing. info:
$file info <option> argsThis is the generic interface method to query the internal data structures set up by the
read method.
streams:
set list [$file info streams]Returns: A list of stream identifiers i.e. a list of
id fields in all the START_STREAM-END_STREAM blocks.
session:
set session [$file info session <id>]Takes as input a stream identifiers (any of the elements of the list returned by
"$file info streams") and returns the session field associated with that stream.
datafile:
set filename [$file info datafile <id>]Takes as input a stream identifiers (any of the elements of the list returned by
"$file info streams") and returns the datafile field associated with that stream. If the datafile field was a relative path, it automatically prepends the directory in which the header file is located to the path.
indexfile:
set filename [$file info indexfile <id>]Takes as input a stream identifiers (any of the elements of the list returned by
"$file info streams") and returns the indexfile field associated with that stream. If the indexfile field was a relative path, it automatically prepends the directory in which the header file is located to the path.