Table of Contents

Interface IFileReference

Namespace
FellowOakDicom.IO
Assembly
fo-dicom.core.dll

Interface representing reference to a single file.

public interface IFileReference
Extension Methods

Properties

Directory

Gets the directory reference of the file.

IDirectoryReference Directory { get; }

Property Value

IDirectoryReference

Exists

Gets whether the file exist or not.

bool Exists { get; }

Property Value

bool

IsTempFile

Gets and sets whether the file is temporary or not.

bool IsTempFile { get; set; }

Property Value

bool

Name

Gets the file name.

string Name { get; }

Property Value

string

Methods

Create()

Creates a new file for reading and writing. Overwrites existing file.

Stream Create()

Returns

Stream

Stream to the created file.

Delete()

Delete the file.

void Delete()

GetByteRange(long, int)

Gets a sub-range of the bytes in the file.

byte[] GetByteRange(long offset, int count)

Parameters

offset long

Offset from the start position of the file.

count int

Number of bytes to select.

Returns

byte[]

The specified sub-range of bytes in the file.

GetByteRange(long, int, byte[])

Gets a sub-range of the bytes in the file.

void GetByteRange(long offset, int count, byte[] output)

Parameters

offset long

Offset from the start position of the file.

count int

Number of bytes to select.

output byte[]

The output array where the contents will be written

Move(string, bool)

Moves file and updates internal reference. Calling this method will also set the IsTempFile property to False.

void Move(string dstFileName, bool overwrite = false)

Parameters

dstFileName string

Full name of the moved file.

overwrite bool

True if already existing file should be overwritten, false otherwise.

Open()

Open an existing file stream for reading and writing.

Stream Open()

Returns

Stream

OpenRead()

Open a file stream for reading.

Stream OpenRead()

Returns

Stream

Stream to the opened file.

OpenWrite()

Open a file stream for writing, creates the file if not existing.

Stream OpenWrite()

Returns

Stream

Stream to the opened file.