String encoding = null;
if(inputType == null) {
Metadata metadata = new Metadata();
metadata.set(Metadata.RESOURCE_NAME_KEY, sourceName);
DefaultDetector detector = new DefaultDetector();
MediaType type = detector.detect(is, metadata);
ContentHandler contenthandler = new BodyContentHandler();
AutoDetectParser parser = new AutoDetectParser();
try {
parser.parse(is, contenthandler, metadata);