コード例 #1
0
        public static void Write(BinaryWriterFast stream, long value, long maximumSize)
        {
            do
            {
                // Write byte
                byte currentByte = unchecked ((byte)(value & 0x7F));
                if (maximumSize >> 6 == 0 || maximumSize >> 6 == -1)
                {
                    stream.Write(currentByte);

                    if (value >> 6 != 0 && value >> 6 != -1)
                    {
                        throw new OverflowException("Unable to write integer because the available space overflowed.");
                    }

                    return;
                }
                stream.Write((byte)(currentByte | 0x80));

                // Move data to next byte
                value       >>= 7;
                maximumSize >>= 7;
            } while (true);
        }
コード例 #2
0
 public void WriteChunkEnd()
 {
     _writer.Write((byte)0);
 }
コード例 #3
0
 public void ToStream(BinaryWriterFast stream)
 {
     LEB128.Write(stream, _idLength);
     stream.Write(_idBytes, 0, _idLength);
 }
コード例 #4
0
 public ChunkWriter(byte[] magicNumber, BinaryWriterFast fastWriter)
 {
     fastWriter.Write(magicNumber, 0, magicNumber.Length);
     fastWriter.Write(BitConverter.GetBytes(0), 0, 4);    // @FIXME: where is the compression handling, as above?
     _writer = fastWriter;
 }