コード例 #1
0
ファイル: DateConverter.cs プロジェクト: zhxjdwh/revenj
        private static DateTime ParseDateSlow(char[] buf, BufferedTextReader reader)
        {
            int foundAt = 4;

            for (; foundAt < buf.Length; foundAt++)
            {
                if (buf[foundAt] == '-')
                {
                    break;
                }
            }
            if (foundAt == buf.Length)
            {
                throw new NotSupportedException("Invalid date value.");
            }
            var year   = IntConverter.ParsePositive(buf, 0, foundAt);
            var newBuf = reader.CharBuffer;

            for (int i = foundAt + 1; i < buf.Length; i++)
            {
                newBuf[i - foundAt - 1] = buf[i];
            }
            for (int i = buf.Length - foundAt - 1; i < 5; i++)
            {
                newBuf[i] = (char)reader.Read();
            }
            return(new DateTime(year, NumberConverter.Read2(newBuf, 0), NumberConverter.Read2(newBuf, 3)));
        }
コード例 #2
0
 private static short ParseShort(BufferedTextReader reader, ref int cur, char endChar)
 {
     return((short)IntConverter.ParseInt(reader, ref cur, endChar));
 }
コード例 #3
0
 public static IPostgresTuple ToTuple(short value)
 {
     return(IntConverter.ToTuple(value));
 }
コード例 #4
0
 public static int Serialize(short value, char[] buf, int start)
 {
     return(IntConverter.Serialize(value, buf, start));
 }