OpenLargeObjectChannel() приватный Метод

private OpenLargeObjectChannel ( ObjectId objId ) : ILargeObjectChannel
objId ObjectId
Результат ILargeObjectChannel
Пример #1
0
 internal DeveelDbLob(DeveelDbConnection connection, ObjectId objId, long size)
     : this(objId, size, FileAccess.Read)
 {
     this.connection = connection;
     lobChannel      = connection.OpenLargeObjectChannel(objId);
     readStream      = new BufferedStream(new LobInputStream(this), (int)(size / 64));
 }
Пример #2
0
 internal DeveelDbLob(DeveelDbConnection connection, ObjectId objId, long size)
     : this(objId, size, FileAccess.Read)
 {
     this.connection = connection;
     lobChannel = connection.OpenLargeObjectChannel(objId);
     readStream = new BufferedStream(new LobInputStream(this), (int)(size/64));
 }
Пример #3
0
        internal static ObjectId Upload(DeveelDbConnection connection, DeveelDbLob lob)
        {
            if (connection == null)
            {
                throw new InvalidOperationException("An open connection is required to upload the LOB");
            }

            var objId = connection.CreateLargeObject(lob.Length);

            using (var channel = connection.OpenLargeObjectChannel(objId)) {
                const int bufferSize = 2048;
                var       copyBuffer = new byte[bufferSize];
                int       readCount;
                long      copyOffset = 0;
                lob.writeStream.Seek(0, SeekOrigin.Begin);

                while ((readCount = lob.writeStream.Read(copyBuffer, 0, bufferSize)) > 0)
                {
                    channel.PushData(copyOffset, copyBuffer, readCount);
                    copyOffset += readCount;
                }
            }

            return(objId);
        }
Пример #4
0
        internal static ObjectId Upload(DeveelDbConnection connection, DeveelDbLob lob)
        {
            if (connection == null)
                throw new InvalidOperationException("An open connection is required to upload the LOB");

            var objId = connection.CreateLargeObject(lob.Length);
            using (var channel = connection.OpenLargeObjectChannel(objId)) {
                const int bufferSize = 2048;
                var copyBuffer = new byte[bufferSize];
                int readCount;
                long copyOffset = 0;
                lob.writeStream.Seek(0, SeekOrigin.Begin);

                while ((readCount = lob.writeStream.Read(copyBuffer, 0, bufferSize)) > 0) {
                    channel.PushData(copyOffset, copyBuffer, readCount);
                    copyOffset += readCount;
                }
            }

            return objId;
        }