OpenLargeObjectChannel() private method

private OpenLargeObjectChannel ( ObjectId objId ) : ILargeObjectChannel
objId ObjectId
return ILargeObjectChannel
Beispiel #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));
 }
Beispiel #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));
 }
Beispiel #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);
        }
Beispiel #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;
        }