CreateLargeObject() 개인적인 메소드

private CreateLargeObject ( long size ) : ObjectId
size long
리턴 ObjectId
예제 #1
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);
        }
예제 #2
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;
        }