Added CSV format sniffing

Now supports multiple CSV formats by trying to guess the
correct format from the first 1000 bytes of the input file.
Uses buffered reading to ensure that only as much of the
input is read as necessary.