Home Units Hierarchy Routines All identifiers

Class unaBitReader_abstract

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type unaBitReader_abstract = class(unaObject)

Description

Abstract base class for bit-reader. Provides methods like EOF(), nextBits() and skipBytes().

Hierarchy

Overview

Methods

Public function nextBits(numBits: unsigned = 8): uint32;
Public function readBytes(numBytes: int; buf: pointer): uint32;
Protected function EOF(numBits: unsigned = 8): bool; virtual; abstract;
Protected function sbAt(at: int = -2): pointer;
Protected function sbLeft(): int;
Public procedure BeforeDestruction(); override;
Public procedure moveBitOfs(delta: int);
Public procedure resetOutfillBuf();
Public procedure restart();
Public procedure setOutfillBuf(buf: pointer);
Public procedure skipBytes(numBytes: unsigned);
Public procedure skipToByte();
Protected procedure doRestart(); virtual;
Protected procedure readSubBuf(reqSize: int = -1; append: bool = false); virtual; abstract;
Protected procedure sbAlloc(sz: int; append: bool);
Protected procedure sbAssign(v: pointer; sz: int);
Protected procedure sbIncrease(delta: int);

Properties

Public property bitOfs: int64 read f_bitOfs;
Public property bytesLeft: int read sbLeft;
Public property isEOF: bool read getIsEOF;
Public property outfill: bool read f_outfill write setOutfill;
Public property outfillOfs: int read f_outfillOfs;

Description

Methods

Public function nextBits(numBits: unsigned = 8): uint32;

Reads given number of bits from buffer.

Parameters
numBits
Number of bits parsers wants to read. Must be from 1 to 32.
Returns

Bitstream from buffer.

Public function readBytes(numBytes: int; buf: pointer): uint32;

Reads given number of bytes into buffer.

Parameters
numBytes
Number of bits parsers wants to read.
buf
Buffer to be filled with bytes
Returns

Actual number of bytes read.

Protected function EOF(numBits: unsigned = 8): bool; virtual; abstract;

Checks if end of file/stream is reached.

Parameters
numBits
Number of bits parsers expects to read.
Returns

True if given number of bits cannot be read or False otherwise.

Protected function sbAt(at: int = -2): pointer;

Returns pointer on internal bytes

Parameters
at
Offset, or -1 = at f_subBufSize; -2 = at f_subBufOfs. Default is -2
Returns

pointer to offset in subbuffer

Protected function sbLeft(): int;
 
Public procedure BeforeDestruction(); override;
 
Public procedure moveBitOfs(delta: int);

Moves bit position.

Public procedure resetOutfillBuf();

Reset outfill buffer/offset.

Public procedure restart();

Cleans up the reader/parser before new file/stream.

Public procedure setOutfillBuf(buf: pointer);

Set outfill buffer.

Public procedure skipBytes(numBytes: unsigned);

Skips given number of bytes.

Parameters
numBytes
Number of bytes parsers wants to skip.
Public procedure skipToByte();

Skips all bits till next byte, making sure next bit-read will start from byte boundary.

Protected procedure doRestart(); virtual;

Cleans up the reader.

Protected procedure readSubBuf(reqSize: int = -1; append: bool = false); virtual; abstract;

Fills subBuf with new portion of data. subBufSize is set to size of data addressed by subBuf. subBufOfs is set to zero.

Protected procedure sbAlloc(sz: int; append: bool);
 
Protected procedure sbAssign(v: pointer; sz: int);
 
Protected procedure sbIncrease(delta: int);
 

Properties

Public property bitOfs: int64 read f_bitOfs;

Current offset in bits from beginning of file/stream.

Public property bytesLeft: int read sbLeft;
 
Public property isEOF: bool read getIsEOF;

True if end of stream/file is reached, False otherwise.

Public property outfill: bool read f_outfill write setOutfill;

When outfill is true, all reading/skipping will fill the outfill buffer as well.

Public property outfillOfs: int read f_outfillOfs;

Offset in outfill buffer

(c) 2012 Lake of Soft


Generated by PasDoc 0.12.1 on 2012-10-09