Example #1
0
        public SnStream(BlobStorageContext context, byte[] rawData = null)
        {
            Context = context;

            _underlyingStream = rawData != null
                ? new RepositoryStream(context.FileId, context.Length, rawData)
                : context.Provider.GetStreamForRead(context);
        }
        private static async Task CopyFromStreamByChunksAsync(BlobStorageContext context, Stream input)
        {
            // This method should be used only when the client has a stream and
            // the target will be a regular SQL varbinary column, because we do
            // not have a special write stream for that case. In every other case
            // the blobprovider API should be used that exposes a writable stream.

            var  buffer = new byte[BlobStorage.BinaryChunkSize];
            int  read;
            long offset = 0;

            while ((read = await input.ReadAsync(buffer, 0, buffer.Length)) > 0)
            {
                await context.Provider.WriteAsync(context, offset, GetLocalBufferAfterRead(read, buffer));

                offset += read;
            }
        }
 private static void UpdateContextProperties(BlobStorageContext context, int versionId, int propertyTypeId, long fullSize)
 {
     context.Length         = fullSize;
     context.VersionId      = versionId;
     context.PropertyTypeId = propertyTypeId;
 }
Example #4
0
 private SnStream(BlobStorageContext context, Stream underlyingStream)
 {
     Context           = context;
     _underlyingStream = underlyingStream;
 }