BaseStreamInterface Class Reference IO

#include <iostreams.h>

Inheritance diagram for BaseStreamInterface:

详细描述

Interface is the base interface for all stream interfaces. It contains the general functions to work with streams (e.g. error handling).

公共成员函数

MAXON_METHOD Result < Int64 GetStreamLength () const
MAXON_METHOD Result < Int64 GetPosition () const
MAXON_METHOD Result < void >  关闭 ()
  MAXON_ADD_TO_REFERENCE_CLASS ( Result < void > ResetMaybeClose() { Result < void > res= OK ;if(this->GetPointer()) { if( System::GetReferenceCounter (this->GetPointer())==1) res=this-> 关闭 ();this->ResetReference();} return res;})
MAXON_METHOD Bool   SeekSupported () const
MAXON_METHOD Result < void >  Seek ( Int64 position)
MAXON_METHOD void  DisableBuffering ()

私有成员函数

  MAXON_INTERFACE ( BaseStreamInterface , MAXON_REFERENCE_NORMAL , "net.maxon.interface.basestream")

成员函数文档编制

◆  MAXON_INTERFACE()

MAXON_INTERFACE ( BaseStreamInterface   ,
MAXON_REFERENCE_NORMAL   ,
"net.maxon.interface.basestream"   
)
private

◆  GetStreamLength()

MAXON_METHOD Result < Int64 > GetStreamLength ( ) const

Returns the length of the stream/file. Be aware that some streams cannot return the file size (e.g. http streams with gzip+chunked transfer encoding). With this example code you can handle both cases correctly. In most cases it's better to not use GetStreamLength() and better use ReadEOS() to read as much as available.

iferr ( Int size = stream.GetStreamLength()) { if (!err.IsInstanceOf<UnknownFileSizeError>()) return err; ... handle unknown size case ... } else { ... handle known size case ... }
返回
Returns the length in bytes. UnknownFileSizeError is returned if the size is unknown.

◆  GetPosition()

MAXON_METHOD Result < Int64 > GetPosition ( ) const

Returns the current stream position. This is the position where the next bytes will be read to or written from.

返回
The current stream position.

◆  Close()

MAXON_METHOD Result <void> Close ( )

Closes the stream.

返回
OK on success.

◆  MAXON_ADD_TO_REFERENCE_CLASS()

MAXON_ADD_TO_REFERENCE_CLASS ( Result < void > ResetMaybeClose() { Result < void > res= OK ;if(this->GetPointer()) { if( System::GetReferenceCounter (this->GetPointer())==1) res=this-> 关闭 ();this->ResetReference();} return res;}  )

◆  SeekSupported()

MAXON_METHOD Bool SeekSupported ( ) const

Returns if the stream supports Seek() . Please note that seeking in stream may effect performance because the caches will be flushed.

返回
True if the output stream supports Seek() .

◆  Seek()

MAXON_METHOD Result <void> Seek ( Int64   position )

Sets the read/write position to this absolute position from the beginning of the stream. For InputStreamInterface : If you want to Seek() forward Skip() is the preferred method to call from the performance perspective.

参数
[in] position Position to jump to within the stream.
返回
OK on success.

◆  DisableBuffering()

MAXON_METHOD void DisableBuffering ( )

The stream may disable buffering when this routine is called (if it supports it). This method is typically used when the buffering is done from the outside.

Int
maxon::Int Int
定义: ge_sys_math.h:62
iferr
#define iferr(...)
定义: errorbase.h:380