Xceed .NET Libraries Documentation
GetStreamBufferSize Method (AbstractFile)


Xceed.FileSystem Assembly > Xceed.FileSystem Namespace > AbstractFile Class : GetStreamBufferSize Method

A reference to a FileSystemEventsSession object that is responsible for raising all events that occur during the process.
Can be null.

A Stream object from which data will be read. Can be null.

A Stream object to which data will be written. Can be null.

A FileSystemItem object into which the file will be copied. Can be null.

Returns the recommended buffer size for a stream copy operation.
Syntax
'Declaration
 
Protected Overridable Function GetStreamBufferSize( _

   ByVal session As FileSystemEventsSession, _

   ByVal sourceStream As Stream, _

   ByVal destinationStream As Stream, _

   ByVal destinationFile As FileSystemItem _

) As Integer
'Usage
 
Dim instance As AbstractFile

Dim session As FileSystemEventsSession

Dim sourceStream As Stream

Dim destinationStream As Stream

Dim destinationFile As FileSystemItem

Dim value As Integer

 

value = instance.GetStreamBufferSize(session, sourceStream, destinationStream, destinationFile)
protected virtual int GetStreamBufferSize( 

   FileSystemEventsSession session,

   Stream sourceStream,

   Stream destinationStream,

   FileSystemItem destinationFile

)

Parameters

session

A reference to a FileSystemEventsSession object that is responsible for raising all events that occur during the process.
Can be null.

sourceStream
A Stream object from which data will be read. Can be null.
destinationStream

A Stream object to which data will be written. Can be null.

destinationFile

A FileSystemItem object into which the file will be copied. Can be null.

Return Value

A value representing the recommended buffer size for a stream copy operation.
Remarks

Methods like CopyTo that perform stream copy operations will call this method to get the buffer
size to use.

The returned value will always be greater than zero.

The default implementation of the method uses the value given by AbstractFile.DefaultStreamBufferSize.

Derived types can override this method and provide a value suited to the media involved and the
supplied parameters.

In most cases, it is not necessary to override the default implementation of this method.

Care must be taken when choosing a buffer size. If the value is too small, the loop count and the number of function calls increase, impacting performance. If the value is too large memory can be used up with no improvements in performance.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

AbstractFile Class
AbstractFile Members