#include <iostreams.h>
Interface is the base interface for all stream interfaces. It contains the general functions to work with streams (e.g. error handling).
Public Member Functions | |
MAXON_METHOD Result< Int64 > | GetStreamLength () const |
MAXON_METHOD Result< Int64 > | GetPosition () const |
MAXON_METHOD Result< void > | Close () |
MAXON_ADD_TO_REFERENCE_CLASS (Result< void > ResetMaybeClose() { Result< void > res=OK;if(this->GetPointer()) { if(System::GetReferenceCounter(this->GetPointer())==1) res=this->Close();this->ResetReference();} return res;}) | |
MAXON_METHOD Bool | SeekSupported () const |
MAXON_METHOD Result< void > | Seek (Int64 position) |
MAXON_METHOD void | DisableBuffering () |
Private Member Functions | |
MAXON_INTERFACE (BaseStreamInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.basestream", MAXON_IMPLEMENTATION_MODULE("net.maxon.kernel")) | |
|
private |
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.
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.
MAXON_METHOD Result<void> Close | ( | ) |
Closes the stream.
MAXON_ADD_TO_REFERENCE_CLASS | ( | Result< void > ResetMaybeClose() { Result< void > res=OK;if(this->GetPointer()) { if(System::GetReferenceCounter(this->GetPointer())==1) res=this->Close();this->ResetReference();} return res;} | ) |
MAXON_METHOD Bool SeekSupported | ( | ) | const |
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. |
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.