Interface IFileReference
Interface representing reference to a single file.
Namespace: FellowOakDicom.IO
Assembly: fo-dicom.core.dll
Syntax
public interface IFileReference
Properties
Directory
Gets the directory reference of the file.
Declaration
IDirectoryReference Directory { get; }
Property Value
Type | Description |
---|---|
IDirectoryReference |
Exists
Gets whether the file exist or not.
Declaration
bool Exists { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsTempFile
Gets and sets whether the file is temporary or not.
Declaration
bool IsTempFile { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Name
Gets the file name.
Declaration
string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
Create()
Creates a new file for reading and writing. Overwrites existing file.
Declaration
Stream Create()
Returns
Type | Description |
---|---|
System.IO.Stream | Stream to the created file. |
Delete()
Delete the file.
Declaration
void Delete()
GetByteRange(Int64, Int32)
Gets a sub-range of the bytes in the file.
Declaration
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[])
Gets a sub-range of the bytes in the file.
Declaration
void GetByteRange(long offset, int count, byte[] output)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | Offset from the start position of the file. |
System.Int32 | count | Number of bytes to select. |
System.Byte[] | output | The output array where the contents will be written |
Move(String, Boolean)
Moves file and updates internal reference.
Calling this method will also set the IsTempFile property to False
.
Declaration
void Move(string dstFileName, bool overwrite = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | dstFileName | Full name of the moved file. |
System.Boolean | overwrite | True if already existing file should be overwritten, false otherwise. |
Open()
Open an existing file stream for reading and writing.
Declaration
Stream Open()
Returns
Type | Description |
---|---|
System.IO.Stream |
OpenRead()
Open a file stream for reading.
Declaration
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
Stream OpenWrite()
Returns
Type | Description |
---|---|
System.IO.Stream | Stream to the opened file. |