TInputStream

A stream of bytes that can be read from front to end.

Inheritance

LevelAncestorDescription
1TObjectUltimate ancestor in a class hierarchy
2TInputStream

Source

Stream.Input.pas (30)

Description

Streams can have a definite or indefinite size but this fact is not known to the user of the stream. To check whether the stream has reached its end one can use AtEnd. If False is returned, this does not necessarily mean that there are more bytes to read. If True is returned one can be sure that the stream has no more bytes and reading more would result in an exception. A call to AtEnd will block for streams with indefinite size until data is known to be available or the stream is known to have reached its end.

The function Available returns the amount of bytes that are known to be still available. This function might return zero while in fact there are still more bytes to read. Implementors of Available are encouraged to return the largest value that can be known to be available without having to implement buffering schemes. A call to Available will never block.

When decoding multi-byte simple values the order of the constituting bytes can either be big endian (higher order bytes first) or little endian (lower order bytes first). TInputStream provides functions to read simple values using either big or little endian encoding. These functions work correctly regardless of the endianness of the underlying platform.

Methods

ScopeVisibilityResultNameDescription
InstancepublicTPositiveInteger32Available()Returns the known amount of bytes available to read, can be zero which does not indicate the end of the stream.
InstancepublicTBooleanAtEnd() Indicates whether the stream has no more bytes to read, when False is returned this does not guarantee that there are more bytes to read. When a stream is blocking a call to AtEnd will block as well.
InstancepublicRead(Buffer; Count: TPositiveInteger32)Reads Count bytes from the stream into Buffer.
InstancepublicSkip(Count: TPositiveInteger64)Skips Count bytes from the stream and discards those bytes.
InstancepublicTPositiveInteger8ReadLittleEndian8()
InstancepublicTPositiveInteger16ReadLittleEndian16()
InstancepublicTPositiveInteger32ReadLittleEndian24()
InstancepublicTPositiveInteger32ReadLittleEndian32()
InstancepublicTPositiveInteger64ReadLittleEndian64()
InstancepublicTFloatingPoint32ReadLittleEndianFloatingPoint32()
InstancepublicTFloatingPoint64ReadLittleEndianFloatingPoint64()
InstancepublicTPositiveInteger32ReadBigEndian8()
InstancepublicTPositiveInteger32ReadBigEndian16()
InstancepublicTPositiveInteger32ReadBigEndian24()
InstancepublicTPositiveInteger32ReadBigEndian32()
InstancepublicTPositiveInteger64ReadBigEndian64()
InstancepublicTFloatingPoint32ReadBigEndianFloatingPoint32()
InstancepublicTFloatingPoint64ReadBigEndianFloatingPoint64()