Class StreamDataProvider
A IWritableDataProvider to support reading and writing to
Inheritance
System.Object
StreamDataProvider
Namespace: PSPDFKit.Providers
Assembly: PSPDFKit.dll
Syntax
public class StreamDataProvider : object, IWritableDataProvider, IDataProvider
Constructors
StreamDataProvider(Stream)
Constructs a data provider to read and write from a
Declaration
public StreamDataProvider(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream to read and write from. |
Methods
Finish()
Declaration
public bool Finish()
Returns
Type | Description |
---|---|
System.Boolean |
GetSize()
Get the length of the data provider.
Declaration
public long GetSize()
Returns
Type | Description |
---|---|
System.Int64 | A long representing the size of the data provider. |
GetUid()
Get a UID to a allow for uniquely identifiable data provider.
Declaration
public string GetUid()
Returns
Type | Description |
---|---|
System.String | A string to use as a UID. |
Read(Int64, Int64)
Reads bytes from the source.
Declaration
public IEnumerable<byte> Read(long size, long offset)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | size | The size of data to read. |
System.Int64 | offset | The offset from which to read from. |
Returns
Type | Description |
---|---|
IEnumerable<System.Byte> | A core vector of data. |
StartWrite(DataSinkOption)
Tells the data provider that writing is about to start. This helps when there is setup to do on the provider.
Declaration
public bool StartWrite(DataSinkOption dataSinkOption)
Parameters
Type | Name | Description |
---|---|---|
DataSinkOption | dataSinkOption | If to append or create a new block of data. |
Returns
Type | Description |
---|---|
System.Boolean | If the data provider setup correctly. |
Write(Byte[])
Write the given data to the data provider.
Declaration
public bool Write(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data to write. |
Returns
Type | Description |
---|---|
System.Boolean | If the write was successful. |