casacore
|
#include <MFFileIO.h>
Public Member Functions | |
MFFileIO (MultiFileBase &, const String &name, ByteIO::OpenOption=ByteIO::Old) | |
Open or create a virtual file with the given name. More... | |
virtual | ~MFFileIO () |
The destructor flushes and closes the file. More... | |
virtual Int64 | read (Int64 size, void *buf, Bool throwException=True) |
Read size bytes from the byte stream. More... | |
virtual void | write (Int64 size, const void *buffer) |
Write a block at the given offset. More... | |
virtual void | reopenRW () |
Reopen the file (and possibly underlying MultiFileBase) for read/write access. More... | |
void | remove () |
Remove the file from the MultiFileBase object. More... | |
virtual void | flush () |
Flush the file by writing all dirty data and all header info. More... | |
virtual Int64 | length () |
Get the length of the file. More... | |
virtual Bool | isReadable () const |
The file is always readable. More... | |
virtual Bool | isWritable () const |
Is the file writable? More... | |
virtual Bool | isSeekable () const |
The file is always seekable. More... | |
virtual String | fileName () const |
Get the file name of the file attached. More... | |
virtual void | fsync () |
Fsync the file (i.e. More... | |
virtual Int64 | doSeek (Int64 offset, ByteIO::SeekOption) |
Reset the position pointer to the given value. More... | |
Public Member Functions inherited from casacore::ByteIO | |
ByteIO () | |
The constructor does nothing. More... | |
virtual | ~ByteIO () |
virtual void | pwrite (Int64 size, Int64 offset, const void *buf) |
Write size bytes to the byte stream at offset . More... | |
virtual Int64 | pread (Int64 size, Int64 offset, void *buf, Bool throwException=True) |
Like read but reads from offset of start of the file The file offset is not changed. More... | |
Int64 | seek (Int offset, ByteIO::SeekOption=ByteIO::Begin) |
This function sets the position on the given offset. More... | |
Int64 | seek (Int64 offset, ByteIO::SeekOption=ByteIO::Begin) |
virtual void | resync () |
Resync the file (i.e. More... | |
Private Attributes | |
MultiFileBase & | itsFile |
Int64 | itsPosition |
String | itsName |
Int | itsId |
Additional Inherited Members | |
Public Types inherited from casacore::ByteIO | |
enum | OpenOption { Old , Update , Append , New , NewNoReplace , Scratch , Delete } |
Define the possible ByteIO open options. More... | |
enum | SeekOption { Begin , Current , End } |
Define the possible seek options. More... | |
Protected Member Functions inherited from casacore::ByteIO | |
ByteIO (const ByteIO &byteIO) | |
Make copy constructor and assignment protected, so a user cannot use them (but a derived class can). More... | |
ByteIO & | operator= (const ByteIO &byteIO) |
Class for IO on a virtual file in a MultiFileBase
Public interface
This class is a specialization of class ByteIO. It uses a MultiFileBase as the data store.
Similar to a regular file it is possible to read and write data and to seek in the file. The object keeps track of the current file offset.
Definition at line 77 of file MFFileIO.h.
casacore::MFFileIO::MFFileIO | ( | MultiFileBase & | , |
const String & | name, | ||
ByteIO::OpenOption | = ByteIO::Old |
||
) |
Open or create a virtual file with the given name.
Note that only the basename of the file name is actually used. It is created in the given MultiFileBase.
|
virtual |
The destructor flushes and closes the file.
|
virtual |
Reset the position pointer to the given value.
It returns the new position.
Implements casacore::ByteIO.
|
virtual |
Get the file name of the file attached.
Reimplemented from casacore::ByteIO.
|
virtual |
Flush the file by writing all dirty data and all header info.
Reimplemented from casacore::ByteIO.
|
virtual |
|
virtual |
The file is always readable.
Implements casacore::ByteIO.
|
virtual |
The file is always seekable.
Implements casacore::ByteIO.
|
virtual |
Is the file writable?
Implements casacore::ByteIO.
|
virtual |
Get the length of the file.
Implements casacore::ByteIO.
|
virtual |
Read size
bytes from the byte stream.
Returns the number of bytes actually read, or a negative number if an error occurred. Will also throw an Exception (AipsError) if the requested number of bytes could not be read unless throwException is set to False.
Implements casacore::ByteIO.
void casacore::MFFileIO::remove | ( | ) |
Remove the file from the MultiFileBase object.
It makes the object invalid by setting the fileId to -1.
|
virtual |
Reopen the file (and possibly underlying MultiFileBase) for read/write access.
Nothing will be done if the stream is writable already. An exception will be thrown if it is not possible to reopen it for read/write access.
Reimplemented from casacore::ByteIO.
|
virtual |
Write a block at the given offset.
Implements casacore::ByteIO.
|
private |
Definition at line 135 of file MFFileIO.h.
|
private |
Definition at line 138 of file MFFileIO.h.
|
private |
Definition at line 137 of file MFFileIO.h.
|
private |
Definition at line 136 of file MFFileIO.h.