Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 1.73 KB

TPJIStreamWrapper-CopyTo.md

File metadata and controls

40 lines (26 loc) · 1.73 KB

CopyTo method

Project: Stream Extension Classes

Unit: PJIStreams

Classes: TPJIStreamWrapper, TPJHandleIStreamWrapper, TPJFileIStream

Applies to: ~>3.0

function CopyTo(stm: IStream; cb: Largeint; out cbRead: Largeint;
  out cbWritten: Largeint): HResult; virtual; stdcall;

Description

Copies a specified number of bytes from the current seek pointer in the wrapped stream to the current seek pointer in another stream. If the wrapped stream has less than the requested number of bytes available then all remaining bytes in the wrapped stream are copied.

Parameters:

  • stm -- Stream to receive copied data, referenced by its IStream interface.
  • cb -- Number of bytes to be copied.
  • cbRead -- Set to number of bytes actually read from wrapped stream.
  • cbWritten -- Set to number of bytes actually written to destination stream.

Returns:

  • S_OK_ on success.
  • E_UNEXPECTED if there is an exception during copying.
  • STG_E_INVALIDPOINTER if stm is nil.
  • STG_E_CANTSAVE if the data can't be written to the destination stream.
  • [~>3.0.0] E_FAIL if the number of bytes requested in cb is greater than MaxInt or is negative. See Remarks.
  • [~>3.1] STG_E_MEDIUMFULL if less than the requested amount of data can be written to the destination stream.

Remarks

  • [~>3.0.0] Although you can request more than 2Gb of data to be copied, the implementation of CopyFrom does not support this and will fail with an E_FAIL return value. This happens regardless of the size of the wrapped stream.

  • [~>3.1] Requests of more than 2Gb of data to be copied are supported.