Class: TFileStream

Declaration: FileSystemInterface.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MOpenFile, TRandomAccessStream

Inherited By:

None.

Purpose:

Read or write a file via a stream.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Do not derive from this class.

Concurrency:

Not multithread safe. This is a handle class.

Resource Use:

No special requirements.

Member Function: TFileStream::Flush

virtual void Flush ()

Interface Category:

API.

Purpose:

Flushes changes to disk: buffered data is written to disk.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized. Throws TFileSystemVolumeAccessError if the volume is full or a media error occurs. Throws TFileSystemAccessDenied if the caller does not have permission to write to the file.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::GetPosition

virtual StreamPosition GetPosition () const

Interface Category:

API.

Purpose:

Obtains the current read/write pointer for the stream.

Calling Context:

Call this function directly.

Parameters:

Return Value:

The current read/write pointer for the stream.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::GetLogicalEndOfStream

virtual StreamPosition GetLogicalEndOfStream () const

Interface Category:

API.

Purpose:

Obtains the logical size of the stream (file).

Calling Context:

Call this function directly.

Parameters:

Return Value:

The logical size of the stream (file).

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::GetPhysicalEndOfStream

virtual StreamPosition GetPhysicalEndOfStream () const

Interface Category:

API.

Purpose:

Obtains the physical size of the stream (file).

Calling Context:

Call this function directly.

Parameters:

Return Value:

The physical size of the stream (file).

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

This is identical to GetLogicalEndOfStream and GetEndOfFile.

Member Function: TFileStream::Seek

virtual void Seek (StreamPosition position)

Interface Category:

API.

Purpose:

Sets the read/write pointer for the stream.

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized. Throws TFileSystemAccessDenied if the position is beyond the current logical end-of-file, and the caller is not privileged to write to the file. Throws TFileSystemVolumeAccessError if the position is beyond the current logical end-of-file, and there is insufficient room on the volume to expand the file.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::SetLogicalEndOfStream

virtual void SetLogicalEndOfStream (StreamPosition)

Interface Category:

API.

Purpose:

Sets the logical size of the stream (file).

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized. Throws TFileSystemAccessDenied if the caller is not privileged to write to the file. Throws TFileSystemVolumeAccessError if the position is beyond the current logical end-of-file, and there is insufficient room on the volume to expand the file.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

This is identical to SetEndOfFile and SetPhysicalEndOfStream.

Member Function: TFileStream::GetEndOfFile

FileSystemEntitySize GetEndOfFile () const

Interface Category:

API.

Purpose:

Gets the logical size of the file (stream).

Calling Context:

Call this function directly.

Parameters:

Return Value:

The logical size of the file (stream).

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

This is identical to GetLogicalEndOfStream and GetPhysicalEndOfStream.

Member Function: TFileStream::SetEndOfFile

void SetEndOfFile (FileSystemEntitySize endOfFile)

Interface Category:

API.

Purpose:

Sets the logical size of the file (stream).

Calling Context:

Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized. Throws TFileSystemAccessDenied if the caller is not privileged to write to the file. Throws TFileSystemVolumeAccessError if the position is beyond the current logical end-of-file, and there is insufficient room on the volume to expand the file.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

This is identical to SetLogicalEndOfStream and SetPhysicalEndOfStream.

Member Function: TFileStream::~TFileStream

virtual ~ TFileStream ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::InitializeFileStream

void InitializeFileStream (const TFile & file, MOpenFile :: EPermissionsForMe forMe, MOpenFile :: EPermissionsForOthers forOthers, FileSystemEntitySize bufferSize)

Interface Category:

API.

Purpose:

Initializes the stream (allows delayed initialization by derived class constructors).

Calling Context:

Called by the default copy constructor of a derived class.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemEntityNotAvailable if the entity cannot be found. Throws TFileSystemAccessDenied if the caller is not privileged to open the file with the requested permissions.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::SetPhysicalEndOfStream

virtual void SetPhysicalEndOfStream (StreamPosition)

Interface Category:

API.

Purpose:

Sets the physical size of the stream (file). For use by derived classes; clients can call SetLogicalEndOfStream or SetEndOfFile to change the file size.

Calling Context:

Not normally called except by derived classes.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized. Throws TFileSystemAccessDenied if the caller is not privileged to write to the file. Throws TFileSystemVolumeAccessError if the position is beyond the current logical end-of-file, and there is insufficient room on the volume to expand the file.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

This is identical to SetLogicalEndOfStream and SetEndOfFile.

Member Function: TFileStream::HandleBufferFull

  1. virtual void HandleBufferFull (signed char c)
  2. virtual void HandleBufferFull (unsigned char c)
  3. virtual void HandleBufferFull (short c)
  4. virtual void HandleBufferFull (unsigned short c)
  5. virtual void HandleBufferFull (long c)
  6. virtual void HandleBufferFull (unsigned long c)
  7. virtual void HandleBufferFull (float c)
  8. virtual void HandleBufferFull (double c)
  9. virtual void HandleBufferFull (const short c [], size_t count)
  10. virtual void HandleBufferFull (const unsigned short c [], size_t count)
  11. virtual void HandleBufferFull (const long c [], size_t count)
  12. virtual void HandleBufferFull (const unsigned long c [], size_t count)
  13. virtual void HandleBufferFull (const float c [], size_t count)
  14. virtual void HandleBufferFull (const double c [], size_t count)

Interface Category:

API.

Purpose:

Fills the internal buffer from the specified source.

Calling Context:

Not normally called except by derived classes.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized. Throws TFileSystemAccessDenied if the caller is not privileged to write to the file.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::HandleBufferEmpty

  1. virtual void HandleBufferEmpty (signed char & c)
  2. virtual void HandleBufferEmpty (unsigned char & c)
  3. virtual void HandleBufferEmpty (short & c)
  4. virtual void HandleBufferEmpty (unsigned short & c)
  5. virtual void HandleBufferEmpty (long & c)
  6. virtual void HandleBufferEmpty (unsigned long & c)
  7. virtual void HandleBufferEmpty (float & c)
  8. virtual void HandleBufferEmpty (double & c)
  9. virtual void HandleBufferEmpty (short c [], size_t count)
  10. virtual void HandleBufferEmpty (unsigned short c [], size_t count)
  11. virtual void HandleBufferEmpty (long c [], size_t count)
  12. virtual void HandleBufferEmpty (unsigned long c [], size_t count)
  13. virtual void HandleBufferEmpty (float c [], size_t count)
  14. virtual void HandleBufferEmpty (double c [], size_t count)

Interface Category:

API.

Purpose:

Empties the internal buffer by transferring its contents to the specified destination.

Calling Context:

Not normally called except by derived classes.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemObjectInvalid if the entity is uninitialized. Throws TStreamException::kHitLogicalEndOfStream if an attempt is made to read beyond end-of-file.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::AllocateForRead

virtual void AllocateForRead (StreamPosition)

Interface Category:

API.

Purpose:

An inherited function for increasing the storage provided by the read buffer. This implementation does nothing.

Calling Context:

Not normally called except by derived classes.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::AllocateForWrite

virtual void AllocateForWrite (StreamPosition)

Interface Category:

API.

Purpose:

An inherited function for increasing the storage provided by the write buffer. This implementation does nothing.

Calling Context:

Not normally called except by derived classes.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::HandleReadBufferEmpty

virtual void HandleReadBufferEmpty (void * destination, size_t destinationSize)

Interface Category:

API.

Purpose:

Called to fill the buffer with data from the source.

Calling Context:

Not normally called except by derived classes.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::HandleWriteBufferFull

virtual void HandleWriteBufferFull (const void * source, size_t sourceSize)

Interface Category:

API.

Purpose:

Called to empty the source by writing the data out.

Calling Context:

Not normally called except by derived classes.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.

Member Function: TFileStream::TFileStream

  1. TFileStream (const TFile & file, MOpenFile :: EPermissionsForMe forMe =MOpenFile :: kReadWrite, MOpenFile :: EPermissionsForOthers forOthers =MOpenFile :: kAllowNone)
  2. TFileStream (const TFile & file, FileSystemEntitySize bufferSize, MOpenFile :: EPermissionsForMe forMe =MOpenFile :: kReadWrite, MOpenFile :: EPermissionsForOthers forOthers =MOpenFile :: kAllowNone)
  3. TFileStream ()

Interface Category:

API.

Purpose:

  1. Constructs a TFileStream for a specified file.
  2. Constructs a TFileStream for a specified file.
  3. Default constructor.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.
  3. Called by the stream-in operators.

Parameters:

Return Value:

None.

Exceptions:

Throws TFileSystemEntityNotAvailable if the entity cannot be found. Throws TFileSystemAccessDenied if the caller is not privileged to open the file with the requested permissions.

Concurrency:

Not multithread safe. This handle class is not safe. The master it refers to is.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.