mFrame
載入中...
搜尋中...
無符合項目
ufm::io::ByteBufferInvert 類別 參考文件

提供大端序(MSB)操作的位元組緩衝區 更多...

#include <ByteBufferInvert.h>

類別ufm::io::ByteBufferInvert的繼承圖:
ufm::io::ByteBuffer ufm::lang::Object ufm::lang::Appendable ufm::lang::Readable ufm::io::Buffer ufm::lang::Interface ufm::lang::Iterable< const char >

公開方法(Public Methods)

 ByteBufferInvert (ufm::lang::Memory memory) noexcept
 使用指定記憶體建立大端序位元組緩衝區
 
 ByteBufferInvert (int length)
 建立指定大小的大端序位元組緩衝區
 
 ByteBufferInvert (void *pointer, int length)
 使用指定指標和長度建立大端序位元組緩衝區
 
virtual ~ByteBufferInvert (void) override
 建立大端序位元組緩衝區,使用現有的記憶體物件
 
bool pollShortMsb (uint16 &result)
 以大端序方式讀取無符號短整數
 
bool pollIntMsb (uint32 &result)
 以大端序方式讀取無符號整數
 
bool putShortMsb (const short value)
 以大端序方式寫入短整數
 
bool putFloatMsb (const float value)
 以大端序方式寫入浮點數
 
bool putIntMsb (const int value)
 以大端序方式寫入整數
 
bool pollShortMsb (short &result)
 以大端序方式讀取短整數
 
bool pollIntMsb (int &result)
 以大端序方式讀取整數
 
bool pollFloatMsb (float &result)
 以大端序方式讀取浮點數
 
- 公開方法(Public Methods) 繼承自 ufm::io::ByteBuffer
 ByteBuffer (ufm::lang::Memory memory) noexcept
 使用現有記憶體建立位元組緩衝區
 
 ByteBuffer (int length)
 建立指定大小的位元組緩衝區
 
 ByteBuffer (void *pointer, int length)
 使用常數指標建立位元組緩衝區
 
virtual ~ByteBuffer (void) override
 釋放緩衝區資源
 
ByteBufferoperator<< (char c)
 重載運算子 <<,將 char 資料寫入 ByteBuffer。
 
ByteBufferoperator<< (short s)
 重載運算子 <<,將 short 資料寫入 ByteBuffer。
 
ByteBufferoperator<< (int v)
 重載運算子 <<,將 int 資料寫入 ByteBuffer。
 
ByteBufferoperator<< (const char *string)
 重載運算子 <<,將字串寫入 ByteBuffer。
 
ByteBufferoperator<< (ufm::lang::Strings &string)
 重載運算子 <<,將 ufm::lang::Strings 物件寫入 ByteBuffer。
 
int operator= (int v)
 重載運算子 =,設定 ByteBuffer 的位置。
 
void operator+= (int shift)
 重載運算子 +=,將 ByteBuffer 的位置向前移動指定的位移量。
 
void operator-= (int shift)
 重載運算子 -=,將 ByteBuffer 的位置向後移動指定的位移量。
 
uint32 operator++ (void)
 重載運算子 ++,將 ByteBuffer 的位置向前移動一位。
 
uint32 operator-- (void)
 重載運算子 –,將 ByteBuffer 的位置向後移動一位。
 
uint32 operator++ (int)
 重載運算子 ++,將 ByteBuffer 的位置向前移動一位(後置)。
 
uint32 operator-- (int)
 重載運算子 –,將 ByteBuffer 的位置向後移動一位(後置)。
 
virtual void clear (void) override
 清空緩衝區內容
 
virtual ufm::lang::ReadablegetReadable (void) override
 獲取 ByteBuffer 的可讀物件。
 
virtual ufm::lang::AppendablegetAppendable (void) override
 獲取 ByteBuffer 的可追加物件。
 
virtual int avariable (void) const override
 取得可讀取的資料數量
 
virtual int pollByte (char &result) override
 讀取一個字節並將其從緩衝區移除
 
virtual int poll (ufm::lang::Appendable &appendable) override
 從緩衝區讀取資料並寫入到Appendable物件中
 
virtual int poll (void *pointer, int length) override
 從緩衝區讀取指定長度的資料到指定的記憶體位置
 
virtual void forEach (ufm::func::Consumer< const char & > &action) override
 遍歷集合中所有元素,對每個元素執行指定操作。 若所有元素處理完畢或操作中發生異常則停止。
 
virtual const char * elementAt (int index) const override
 獲取集合中指定索引處的元素。
 
virtual int nextIndex (int index) const override
 返回當前索引的下一個有效索引。
 
virtual ufm::util::Iterator< const char > begin (void) override
 返回一個迭代器,用於遍歷集合中的元素
 
virtual ufm::util::Iterator< const char > end (void) override
 返回一個迭代器,用於遍歷集合的結尾
 
virtual int remaining (void) const override
 取得緩衝區剩餘空閒字節數。
 
virtual int putByte (const char data) override
 輸入單一字節至緩衝區
 
virtual int put (ufm::lang::Readable &readable) override
 從 Readable 物件附加資料至緩衝區
 
virtual int put (const void *pointer, int length) override
 從記憶體指標附加資料至緩衝區
 
int limit (void) const
 獲取 ByteBuffer 的限制。
 
int capacity (void) const
 獲取 ByteBuffer 的容量。
 
int position (void) const
 獲取 ByteBuffer 的位置。
 
ByteBufferreset (void)
 重置 ByteBuffer 的位置到標記。
 
ByteBuffermark (void)
 標記 ByteBuffer 的當前位置。
 
ByteBufferrewind (void)
 ByteBuffer 的位置重置為 0。
 
bool pollByte (uint8 &result)
 ByteBuffer 中提取一個 byte。
 
bool pollShort (uint16 &result)
 ByteBuffer 中提取一個 short。
 
bool pollInt (uint32 &result)
 ByteBuffer 中提取一個 int。
 
ufm::lang::Memorymemory (void)
 獲取 ByteBuffer 的記憶體。
 
bool limit (int newLimit)
 設定 ByteBuffer 的限制。
 
bool position (int newPosition)
 設定 ByteBuffer 的位置。
 
void flip (void)
 翻轉緩衝區,為讀取已寫入資料做準備
 
void move (int position)
 將位置移動到指定位置
 
bool put (const char *string)
 將字串寫入 ByteBuffer。
 
bool put (const ufm::lang::Strings &string)
 ufm::lang::Strings 物件寫入 ByteBuffer。
 
int putFormat (const char *format,...)
 將格式化字串寫入 ByteBuffer。
 
int putFormat (const char *format, va_list args)
 將格式化字串寫入 ByteBuffer。
 
bool putShort (const short value)
 將 short 資料寫入 ByteBuffer。
 
bool putInt (const int value)
 將 int 資料寫入 ByteBuffer。
 
bool putFloat (const float value)
 將 float 資料寫入 ByteBuffer。
 
bool pollShort (short &result)
 ByteBuffer 中提取一個 short。
 
bool pollInt (int &result)
 ByteBuffer 中提取一個 int。
 
bool pollFloat (float &result)
 ByteBuffer 中提取一個 float。
 
- 公開方法(Public Methods) 繼承自 ufm::lang::Object
void * operator new (size_t n)
 使用運算子 new 分配記憶體
 
void * operator new (size_t n, void *p)
 在指定記憶體上調用運算子 new
 
virtual ufm::lang::ObjectgetObject (void) override
 取得對應的 Object 物件
 
void delay (int milliseconds) const
 延遲指定的毫秒數進行執行緒等待
 
bool equals (Object *object) const
 判斷與另一物件是否為相同參照(指標型態比較)
 
bool equals (Object &object) const
 判斷與另一物件是否為相同參照(參照型態比較)
 
void wait (void) const
 使當前線程等待直到被通知
 
bool wait (int timeout) const
 等待通知或超時
 
bool yield (void) const
 讓執行緒讓渡控制權給同優先權的下一個執行緒
 
int lock (void) const
 核心鎖定,鎖定期間禁止線程切換
 
int unlock (void) const
 核心解鎖
 
ufm::sys::ThreadcurrentThread (void) const
 取得當前執行緒指標
 
virtual int hashcode (void) const
 返回對象的哈希碼值。支持這種方法是為了散列表,如HashMap提供的那樣。
 
- 公開方法(Public Methods) 繼承自 ufm::lang::Interface
virtual ~Interface (void)=default
 虛擬析構函式
 
- 公開方法(Public Methods) 繼承自 ufm::lang::Appendable
int put (ufm::lang::Readable &&readable)
 從右值 Readable 附加資料
 
bool isFull (void) const
 檢查緩衝區是否已滿
 
- 公開方法(Public Methods) 繼承自 ufm::lang::Readable
bool isEmpty (void) const
 檢查緩衝區是否為空
 
int poll (ufm::lang::Appendable &&appendable)
 從緩衝區讀取資料到臨時Appendable物件中
 
int skip (int length)
 跳過緩衝區中指定數量的資料
 

額外的繼承成員

- 保護屬性 繼承自 ufm::io::ByteBuffer
ufm::lang::Memory vMemory
 
int vPosition
 
int vMark
 
int vLimit
 

詳細描述

提供大端序(MSB)操作的位元組緩衝區

ByteBufferInvert 擴展自 ByteBuffer,專門處理需要大端序表示的多位元組資料。 在網路通訊和某些檔案格式中,資料常以大端序儲存,此類別提供了便捷的轉換方法, 使開發人員無需手動處理位元組順序轉換。

1.0.0

建構子與解構子說明文件

◆ ByteBufferInvert() [1/3]

ufm::io::ByteBufferInvert::ByteBufferInvert ( ufm::lang::Memory memory)
inlinenoexcept

使用指定記憶體建立大端序位元組緩衝區

參數
memory底層儲存資料的記憶體物件

◆ ByteBufferInvert() [2/3]

ufm::io::ByteBufferInvert::ByteBufferInvert ( int length)
inline

建立指定大小的大端序位元組緩衝區

參數
length緩衝區大小(位元組)

◆ ByteBufferInvert() [3/3]

ufm::io::ByteBufferInvert::ByteBufferInvert ( void * pointer,
int length )
inline

使用指定指標和長度建立大端序位元組緩衝區

參數
pointer指向緩衝區資料的指標
length緩衝區大小(位元組)

◆ ~ByteBufferInvert()

virtual ufm::io::ByteBufferInvert::~ByteBufferInvert ( void )
overridevirtual

建立大端序位元組緩衝區,使用現有的記憶體物件

參數
memory已存在的記憶體物件

函式成員說明文件

◆ pollFloatMsb()

bool ufm::io::ByteBufferInvert::pollFloatMsb ( float & result)

以大端序方式讀取浮點數

參數
result儲存讀取結果的變數引用
傳回值
true 讀取成功
false 讀取失敗(如資料不足)

◆ pollIntMsb() [1/2]

bool ufm::io::ByteBufferInvert::pollIntMsb ( int & result)

以大端序方式讀取整數

參數
result儲存讀取結果的變數引用
傳回值
true 讀取成功
false 讀取失敗(如資料不足)

◆ pollIntMsb() [2/2]

bool ufm::io::ByteBufferInvert::pollIntMsb ( uint32 & result)
inline

以大端序方式讀取無符號整數

參數
result儲存讀取結果的變數引用
傳回值
true 讀取成功
false 讀取失敗(如資料不足)

◆ pollShortMsb() [1/2]

bool ufm::io::ByteBufferInvert::pollShortMsb ( short & result)

以大端序方式讀取短整數

參數
result儲存讀取結果的變數引用
傳回值
true 讀取成功
false 讀取失敗(如資料不足)

◆ pollShortMsb() [2/2]

bool ufm::io::ByteBufferInvert::pollShortMsb ( uint16 & result)
inline

以大端序方式讀取無符號短整數

參數
result儲存讀取結果的變數引用
傳回值
true 讀取成功
false 讀取失敗(如資料不足)

◆ putFloatMsb()

bool ufm::io::ByteBufferInvert::putFloatMsb ( const float value)

以大端序方式寫入浮點數

參數
value要寫入的浮點數值
傳回值
true 寫入成功
false 寫入失敗(如空間不足)

◆ putIntMsb()

bool ufm::io::ByteBufferInvert::putIntMsb ( const int value)

以大端序方式寫入整數

參數
value要寫入的整數值
傳回值
true 寫入成功
false 寫入失敗(如空間不足)

◆ putShortMsb()

bool ufm::io::ByteBufferInvert::putShortMsb ( const short value)

以大端序方式寫入短整數

參數
value要寫入的短整數值
傳回值
true 寫入成功
false 寫入失敗(如空間不足)

此類別(class) 文件是由下列檔案中產生: