UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FPakFileHandle< ReaderPolicy > Class Template Reference

#include <IPlatformFilePak.h>

+ Inheritance diagram for FPakFileHandle< ReaderPolicy >:

Public Member Functions

 FPakFileHandle (const TRefCountPtr< const FPakFile > &InPakFile, const FPakEntry &InPakEntry, TAcquirePakReaderFunction &InAcquirePakReaderFunction)
 
 FPakFileHandle (const TRefCountPtr< const FPakFile > &InPakFile, const FPakEntry &InPakEntry, FArchive *InPakReader)
 
virtual ~FPakFileHandle ()
 
virtual int64 Tell () override
 
virtual bool Seek (int64 NewPosition) override
 
virtual bool SeekFromEnd (int64 NewPositionRelativeToEnd) override
 
virtual bool Read (uint8 *Destination, int64 BytesToRead) override
 
virtual bool ReadAt (uint8 *Destination, int64 BytesToRead, int64 Offset) override
 
virtual bool Write (const uint8 *Source, int64 BytesToWrite) override
 
virtual int64 Size () override
 
virtual bool Flush (const bool bFullFlush=false) override
 
virtual bool Truncate (int64 NewSize) override
 
- Public Member Functions inherited from IFileHandle
virtual ~IFileHandle ()
 
virtual void ShrinkBuffers ()
 

Detailed Description

template<typename ReaderPolicy = FPakReaderPolicy<>>
class FPakFileHandle< ReaderPolicy >

File handle to read from pak file.

Constructor & Destructor Documentation

◆ FPakFileHandle() [1/2]

template<typename ReaderPolicy = FPakReaderPolicy<>>
FPakFileHandle< ReaderPolicy >::FPakFileHandle ( const TRefCountPtr< const FPakFile > &  InPakFile,
const FPakEntry InPakEntry,
TAcquirePakReaderFunction InAcquirePakReaderFunction 
)
inline

Constructs pak file handle to read from pak.

Parameters
InFilenameFilename
InPakEntryEntry in the pak file.
InAcquirePakReaderFunctionFunction that returns the archive to use for serialization. The result of this should not be cached, but reacquired on each serialization operation

◆ FPakFileHandle() [2/2]

template<typename ReaderPolicy = FPakReaderPolicy<>>
FPakFileHandle< ReaderPolicy >::FPakFileHandle ( const TRefCountPtr< const FPakFile > &  InPakFile,
const FPakEntry InPakEntry,
FArchive InPakReader 
)
inline

Constructs pak file handle to read from pak.

Parameters
InFilenameFilename
InPakEntryEntry in the pak file.
InPakFilePak file.

◆ ~FPakFileHandle()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual FPakFileHandle< ReaderPolicy >::~FPakFileHandle ( )
inlinevirtual

Destructor. Cleans up the reader archive if necessary.

Member Function Documentation

◆ Flush()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual bool FPakFileHandle< ReaderPolicy >::Flush ( const bool  bFullFlush = false)
inlineoverridevirtual

Flushes file handle to disk.

Parameters
bFullFlushtrue to flush everything about the file (including its meta-data) with a strong guarantee that it will be on disk by the time this function returns, or false to let the operating/file system have more leeway about when the data actually gets written to disk
Returns
true if operation completed successfully.

Implements IFileHandle.

◆ Read()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual bool FPakFileHandle< ReaderPolicy >::Read ( uint8 Destination,
int64  BytesToRead 
)
inlineoverridevirtual

Read bytes from the file.

Parameters
DestinationBuffer to holds the results, should be at least BytesToRead in size.
BytesToReadNumber of bytes to read into the destination.
Returns
true if the operation completed successfully. Returns false if a read is attempted while the read position is already at the end of the file.
Remarks
If BytesToRead is larger than the bytes remaining in the file from the current read position the Read() will return true if the underlying file read could read all remaining bytes.

Implements IFileHandle.

◆ ReadAt()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual bool FPakFileHandle< ReaderPolicy >::ReadAt ( uint8 Destination,
int64  BytesToRead,
int64  Offset 
)
inlineoverridevirtual

Implements IFileHandle.

◆ Seek()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual bool FPakFileHandle< ReaderPolicy >::Seek ( int64  NewPosition)
inlineoverridevirtual

Change the current write or read position.

Parameters
NewPositionnew write or read position
Returns
true if the operation completed successfully.

Implements IFileHandle.

◆ SeekFromEnd()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual bool FPakFileHandle< ReaderPolicy >::SeekFromEnd ( int64  NewPositionRelativeToEnd)
inlineoverridevirtual

Change the current write or read position, relative to the end of the file.

Parameters
NewPositionRelativeToEndnew write or read position, relative to the end of the file should be <=0!
Returns
true if the operation completed successfully.

Implements IFileHandle.

◆ Size()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual int64 FPakFileHandle< ReaderPolicy >::Size ( )
inlineoverridevirtual

Return the total size of the file

Reimplemented from IFileHandle.

◆ Tell()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual int64 FPakFileHandle< ReaderPolicy >::Tell ( )
inlineoverridevirtual

Return the current write or read position.

Implements IFileHandle.

◆ Truncate()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual bool FPakFileHandle< ReaderPolicy >::Truncate ( int64  NewSize)
inlineoverridevirtual

Truncate the file to the given size (in bytes).

Parameters
NewSizeTruncated file size (in bytes).
Returns
true if the operation completed successfully.

Implements IFileHandle.

◆ Write()

template<typename ReaderPolicy = FPakReaderPolicy<>>
virtual bool FPakFileHandle< ReaderPolicy >::Write ( const uint8 Source,
int64  BytesToWrite 
)
inlineoverridevirtual

Write bytes to the file.

Parameters
SourceBuffer to write, should be at least BytesToWrite in size.
BytesToWriteNumber of bytes to write.
Returns
true if the operation completed successfully.

Implements IFileHandle.


The documentation for this class was generated from the following file: