예제 #1
0
        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));
 }