Esempio n. 1
0
        private byte[] ReadStringBytes()
        {
            var sizeBytes = _io.ReadBytes(IntSizeX2);
            var totalSize = ByteArrayConverter.ByteArrayToInt(sizeBytes);

            // Use offset of int size to read real size
            var stringSize = ByteArrayConverter.ByteArrayToInt(sizeBytes, OdbType.Integer.Size);
            var bytes      = ReadBytes(stringSize);

            // Reads extra bytes
            ReadBytes(totalSize - stringSize);

            var bytes2 = new byte[stringSize + IntSizeX2];

            for (var i = 0; i < IntSizeX2; i++)
            {
                bytes2[i] = sizeBytes[i];
            }

            for (var i = 0; i < bytes.Length; i++)
            {
                bytes2[i + 8] = bytes[i];
            }

            return(bytes2);
        }
Esempio n. 2
0
        public void WriteString(string s, bool writeInTransaction, int totalSpace)
        {
            var bytes = ByteArrayConverter.StringToByteArray(s, totalSpace);

            if (!writeInTransaction)
            {
                _io.WriteBytes(bytes);
            }
            else
            {
                _session.GetTransaction().ManageWriteAction(_io.CurrentPosition, bytes);
                EnsureSpaceFor(bytes.Length, OdbType.String);
            }
        }
Esempio n. 3
0
        public void WriteBigDecimal(Decimal d, bool writeInTransaction)
        {
            var bytes = ByteArrayConverter.DecimalToByteArray(d);

            if (!writeInTransaction)
            {
                _io.WriteBytes(bytes);
            }
            else
            {
                _session.GetTransaction().ManageWriteAction(_io.CurrentPosition, bytes);
                EnsureSpaceFor(bytes.Length, OdbType.Decimal);
            }
        }
Esempio n. 4
0
 public bool ReadBoolean()
 {
     return(ByteArrayConverter.ByteArrayToBoolean(ReadBooleanBytes()));
 }
Esempio n. 5
0
 public string ReadString()
 {
     return(ByteArrayConverter.ByteArrayToString(ReadStringBytes()));
 }
Esempio n. 6
0
 public DateTime ReadDate()
 {
     return(ByteArrayConverter.ByteArrayToDate(ReadDateBytes()));
 }
Esempio n. 7
0
 public Decimal ReadBigDecimal()
 {
     return(ByteArrayConverter.ByteArrayToDecimal(ReadBigDecimalBytes()));
 }
Esempio n. 8
0
 public double ReadDouble()
 {
     return(ByteArrayConverter.ByteArrayToDouble(ReadDoubleBytes()));
 }
Esempio n. 9
0
 public ulong ReadULong()
 {
     return(ByteArrayConverter.ByteArrayToULong(ReadULongBytes()));
 }
Esempio n. 10
0
 public float ReadFloat()
 {
     return(ByteArrayConverter.ByteArrayToFloat(ReadFloatBytes()));
 }
Esempio n. 11
0
 public long ReadLong()
 {
     return(ByteArrayConverter.ByteArrayToLong(ReadLongBytes()));
 }
Esempio n. 12
0
 public uint ReadUInt()
 {
     return(ByteArrayConverter.ByteArrayToUInt(ReadUIntBytes()));
 }
Esempio n. 13
0
 public int ReadInt()
 {
     return(ByteArrayConverter.ByteArrayToInt(ReadIntBytes()));
 }
Esempio n. 14
0
 public ushort ReadUShort()
 {
     return(ByteArrayConverter.ByteArrayToUShort(ReadUShortBytes()));
 }
Esempio n. 15
0
 public char ReadChar()
 {
     return(ByteArrayConverter.ByteArrayToChar(ReadCharBytes()));
 }