Skip to content

TTarArchive.ReadFile

Read a file from the archive.

Declaration

Source position: libtar.pp line 191

public 
procedure ReadFile(Buffer: POINTER);  overload; overload;

procedure ReadFile(Stream: TStream);  overload; overload;

procedure ReadFile(const Filename: AnsiString);  overload; overload;

function ReadFile : RawByteString;  overload; overload;

Description

ReadFile can be used to read the current file in the archive. It can be called after the archive was successfully positioned on an entry in the archive. The file can be read in various ways:

  • directly in a memory buffer. No checks are performed to see whether the buffer points to enough memory.
  • It can be copied to a Stream.
  • It can be copied to a file with name FileName.
  • The file content can be copied to a string

Errors

An exception may occur if the buffer is not large enough, or when the file specified in filename cannot be opened.