Skip to content

Latest commit

 

History

History
36 lines (22 loc) · 1.43 KB

TPJIStreamWrapper-Read.md

File metadata and controls

36 lines (22 loc) · 1.43 KB

Read method

Project: Stream Extension Classes

Unit: PJIStreams

Classes: TPJIStreamWrapper, TPJHandleIStreamWrapper, TPJFileIStream

Applies to: ~>3.0

function Read(pv: Pointer; cb: Longint; pcbRead: PLongint): HResult;
  virtual; stdcall;

Description

Reads a specified number of bytes from the wrapped stream into memory starting at the current seek pointer. The seek pointer is incremented by the number of bytes read.

Parameters:

  • pv -- Pointer to buffer to receive data read from wrapped stream.
  • cb -- Number of bytes to be read.
  • pcbRead -- Pointer to value that receives number of bytes actually read. May be nil in which case the parameter is ignored.

Returns:

  • S_OK on success.
  • S_FAIL on error reading stream.
  • STG_E_INVALIDPOINTER if pv is nil.

Remarks

If the requested number of bytes are available in the wrapped stream then pv^ receives cb bytes and pcbRead^ is set equal to cb. If there is insufficient data remaining in the wrapped stream to fulfil the request then any remaining bytes are read from the stream into pv^ and pcbRead^ will be less than cb. If the stream is at the end when the request is made then no data is copied into pv^ and pcbRead^ is set to zero.

The buffer pointed to by pv must have capacity of at least cb bytes.