UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
IFileHandle Class Referenceabstract

#include <GenericPlatformFile.h>

+ Inheritance diagram for IFileHandle:

Public Member Functions

virtual ~IFileHandle ()
 
virtual int64 Tell ()=0
 
virtual bool Seek (int64 NewPosition)=0
 
virtual bool SeekFromEnd (int64 NewPositionRelativeToEnd=0)=0
 
virtual bool Read (uint8 *Destination, int64 BytesToRead)=0
 
virtual bool ReadAt (uint8 *Destination, int64 BytesToRead, int64 Offset)=0
 
virtual bool Write (const uint8 *Source, int64 BytesToWrite)=0
 
virtual bool Flush (const bool bFullFlush=false)=0
 
virtual bool Truncate (int64 NewSize)=0
 
virtual void ShrinkBuffers ()
 
virtual CORE_API int64 Size ()
 

Detailed Description

File handle interface.

Constructor & Destructor Documentation

◆ ~IFileHandle()

virtual IFileHandle::~IFileHandle ( )
inlinevirtual

Destructor, also the only way to close the file handle

Member Function Documentation

◆ Flush()

virtual bool IFileHandle::Flush ( const bool  bFullFlush = false)
pure virtual

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.

Implemented in FFileHandleApple, FIOSFileHandle, FFileHandleUnix, FFileHandleWindows, FCachedFileHandle, FLoggedFileHandle, FManagedStorageFileWriteHandle, FNetworkFileHandle, FPakFileHandle< ReaderPolicy >, FStorageServerFileHandle, and FStreamingNetworkFileHandle.

◆ Read()

virtual bool IFileHandle::Read ( uint8 Destination,
int64  BytesToRead 
)
pure virtual

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.

Implemented in FFileHandleApple, FIOSFileHandle, FFileHandleUnix, FFileHandleWindows, FCachedFileHandle, FLoggedFileHandle, FManagedStorageFileWriteHandle, FNetworkFileHandle, FPakFileHandle< ReaderPolicy >, FStorageServerFileHandle, and FStreamingNetworkFileHandle.

◆ ReadAt()

◆ Seek()

virtual bool IFileHandle::Seek ( int64  NewPosition)
pure virtual

Change the current write or read position.

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

Implemented in FFileHandleApple, FIOSFileHandle, FFileHandleUnix, FFileHandleWindows, FCachedFileHandle, FLoggedFileHandle, FManagedStorageFileWriteHandle, FNetworkFileHandle, FPakFileHandle< ReaderPolicy >, FStorageServerFileHandle, and FStreamingNetworkFileHandle.

◆ SeekFromEnd()

virtual bool IFileHandle::SeekFromEnd ( int64  NewPositionRelativeToEnd = 0)
pure virtual

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.

Implemented in FLoggedFileHandle, FPakFileHandle< ReaderPolicy >, FFileHandleApple, FIOSFileHandle, FFileHandleUnix, FFileHandleWindows, FCachedFileHandle, FManagedStorageFileWriteHandle, FNetworkFileHandle, FStorageServerFileHandle, and FStreamingNetworkFileHandle.

◆ ShrinkBuffers()

virtual void IFileHandle::ShrinkBuffers ( )
inlinevirtual

Minimizes optional system or process cache kept for the file.

Reimplemented in FFileHandleWindows, FCachedFileHandle, FLoggedFileHandle, and FManagedStorageFileWriteHandle.

◆ Size()

◆ Tell()

◆ Truncate()

virtual bool IFileHandle::Truncate ( int64  NewSize)
pure virtual

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

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

Implemented in FFileHandleApple, FIOSFileHandle, FFileHandleUnix, FFileHandleWindows, FCachedFileHandle, FLoggedFileHandle, FManagedStorageFileWriteHandle, FNetworkFileHandle, FPakFileHandle< ReaderPolicy >, FStorageServerFileHandle, and FStreamingNetworkFileHandle.

◆ Write()

virtual bool IFileHandle::Write ( const uint8 Source,
int64  BytesToWrite 
)
pure virtual

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.

Implemented in FFileHandleApple, FIOSFileHandle, FFileHandleUnix, FFileHandleWindows, FCachedFileHandle, FLoggedFileHandle, FManagedStorageFileWriteHandle, FNetworkFileHandle, FPakFileHandle< ReaderPolicy >, FStorageServerFileHandle, and FStreamingNetworkFileHandle.


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