78edff6f7f
git-svn-id: http://google-refine.googlecode.com/svn/trunk@2170 7d457c2a-affb-35e4-300a-418c747d4874
22 lines
639 B
Java
22 lines
639 B
Java
package com.google.refine.importers;
|
|
|
|
import java.io.File;
|
|
|
|
import com.google.refine.importing.FormatGuesser;
|
|
|
|
public class LineBasedFormatGuesser implements FormatGuesser {
|
|
|
|
@Override
|
|
public String guess(File file, String encoding, String seedFormat) {
|
|
SeparatorBasedImporter.Separator sep = SeparatorBasedImporter.guessSeparator(file, encoding);
|
|
if (sep != null) {
|
|
return "text/line-based/*sv";
|
|
}
|
|
int[] widths = FixedWidthImporter.guessColumnWidths(file, encoding);
|
|
if (widths != null) {
|
|
return "text/line-based/fixed-width";
|
|
}
|
|
return null;
|
|
}
|
|
}
|