Table of Contents

Class FileReference

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

Implementation of the IFileReference interface.

public sealed class FileReference : IFileReference
Inheritance
FileReference
Implements
Inherited Members
Extension Methods

Constructors

FileReference(string)

Initializes a FileReference object.

public FileReference(string fileName)

Parameters

fileName string

File name.

Properties

Directory

Gets the directory reference of the file.

public IDirectoryReference Directory { get; }

Property Value

IDirectoryReference

Exists

Gets whether the file exist or not.

public bool Exists { get; }

Property Value

bool

IsTempFile

Gets and sets whether the file is temporary or not.

public bool IsTempFile { get; set; }

Property Value

bool

Remarks

Temporary file will be deleted when object is Disposed.

Name

Gets the file name.

public string Name { get; }

Property Value

string

Methods

Create()

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

public Stream Create()

Returns

Stream

Stream to the created file.

Delete()

Delete the file.

public void Delete()

~FileReference()

Destructor.

protected ~FileReference()

GetByteRange(long, int)

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

public 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.

public 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 remove set the IsTempFile property to False.

public void Move(string dstFileName, bool overwrite = false)

Parameters

dstFileName string

Name of the destination file.

overwrite bool

True if dstFileName should be overwritten if it already exists, false otherwise.

Open()

Open an existing file stream for reading and writing.

public Stream Open()

Returns

Stream

OpenRead()

Open a file stream for reading.

public Stream OpenRead()

Returns

Stream

Stream to the opened file.

OpenWrite()

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

public Stream OpenWrite()

Returns

Stream

Stream to the opened file.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.