Fellow Oak DICOM
Search Results for

    Show / Hide Table of Contents

    Class FileReference

    Implementation of the IFileReference interface.

    Inheritance
    System.Object
    FileReference
    Implements
    IFileReference
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: FellowOakDicom.IO
    Assembly: fo-dicom.core.dll
    Syntax
    public sealed class FileReference : IFileReference

    Constructors

    FileReference(String)

    Initializes a FileReference object.

    Declaration
    public FileReference(string fileName)
    Parameters
    Type Name Description
    System.String fileName

    File name.

    Properties

    Directory

    Gets the directory reference of the file.

    Declaration
    public IDirectoryReference Directory { get; }
    Property Value
    Type Description
    IDirectoryReference

    Exists

    Gets whether the file exist or not.

    Declaration
    public bool Exists { get; }
    Property Value
    Type Description
    System.Boolean

    IsTempFile

    Gets and sets whether the file is temporary or not.

    Declaration
    public bool IsTempFile { get; set; }
    Property Value
    Type Description
    System.Boolean
    Remarks

    Temporary file will be deleted when object is Disposed.

    Name

    Gets the file name.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    System.String

    Methods

    Create()

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

    Declaration
    public Stream Create()
    Returns
    Type Description
    System.IO.Stream

    Stream to the created file.

    Delete()

    Delete the file.

    Declaration
    public void Delete()

    Finalize()

    Destructor.

    Declaration
    protected void Finalize()

    GetByteRange(Int64, Int32)

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

    Declaration
    public byte[] GetByteRange(long offset, int count)
    Parameters
    Type Name Description
    System.Int64 offset

    Offset from the start position of the file.

    System.Int32 count

    Number of bytes to select.

    Returns
    Type Description
    System.Byte[]

    The specified sub-range of bytes in the file.

    GetByteRange(Int64, Int32, Byte[])

    Declaration
    public void GetByteRange(long offset, int count, byte[] output)
    Parameters
    Type Name Description
    System.Int64 offset
    System.Int32 count
    System.Byte[] output

    Move(String, Boolean)

    Moves file and updates internal reference.

    Calling this method will also remove set the IsTempFile property to False.

    Declaration
    public void Move(string dstFileName, bool overwrite = false)
    Parameters
    Type Name Description
    System.String dstFileName

    Name of the destination file.

    System.Boolean overwrite

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

    Open()

    Open an existing file stream for reading and writing.

    Declaration
    public Stream Open()
    Returns
    Type Description
    System.IO.Stream

    OpenRead()

    Open a file stream for reading.

    Declaration
    public Stream OpenRead()
    Returns
    Type Description
    System.IO.Stream

    Stream to the opened file.

    OpenWrite()

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

    Declaration
    public Stream OpenWrite()
    Returns
    Type Description
    System.IO.Stream

    Stream to the opened file.

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    A string that represents the current object.

    Overrides
    System.Object.ToString()

    Implements

    IFileReference

    Extension Methods

    LinqExtensions.IsOneOf<T>(T, T[])
    In This Article
    Back to top Copyright (c) 2012-2025 fo-dicom contributors