private static byte[] WriteLengthData(int value)
        {
            var target = new SnappyCompressor();
            var data = new byte[10];

            target.WriteUncomressedLength(data, 0, value);
            return data;
        }
        private static byte[] WriteLengthData(int value)
        {
            var target = new SnappyCompressor();
            var data   = new byte[10];

            target.WriteUncomressedLength(data, 0, value);
            return(data);
        }
        public void returns_index_into_buffer()
        {
            var target = new SnappyCompressor();
            var data = new byte[10];

            var result = target.WriteUncomressedLength(data, 0, 2097150);

            Assert.Equal(3, result);
        }
        public void returns_index_into_buffer()
        {
            var target = new SnappyCompressor();
            var data   = new byte[10];

            var result = target.WriteUncomressedLength(data, 0, 2097150);

            Assert.Equal(3, result);
        }
Esempio n. 5
0
    public override void Write(byte[] buffer, int offset, int count)
    {
        if (compressionMode != CompressionMode.Compress || compressor == null)
        {
            throw new InvalidOperationException("Cannot write if not Set to compression mode.");
        }

        if (buffer.Length < count)
        {
            throw new InvalidOperationException();
        }

        for (int i = 0; i < count; i += BLOCK_SIZE)
        {
            stream.WriteByte(CompressedType);
            compressor.WriteUncomressedLength(buffer, 1, count);
            int compressedLength = compressor.CompressInternal(buffer, offset, count, internalBuffer, 2);
            stream.Write(internalBuffer, 0, compressedLength + 3);
        }
    }