@Override
	public void scanForSentences(final SentenceParserCallback parser)
			throws Exception {
		SentenceParserImpl impl = new SentenceParserImpl() {

			@Override
			public boolean found(Sentence sentence) {
				return parser.found(sentence);
			}
		};

		byte[] buf = new byte[4096];
		java.io.FileInputStream fis = new java.io.FileInputStream(file);

		UniversalDetector detector = new UniversalDetector(null);
		int nread;
		while ((nread = fis.read(buf)) > 0 && !detector.isDone()) {
			detector.handleData(buf, 0, nread);
		}
		detector.dataEnd();
		String encoding = detector.getDetectedCharset();

		detector.reset();

		fis.close();
		fis = new java.io.FileInputStream(file);

		InputStreamReader reader;

		if (encoding != null) {
			reader = new InputStreamReader(fis, encoding);
		} else
			reader = new InputStreamReader(fis);

		int ch;

		StringBuilder sb = new StringBuilder();

		while ((ch = reader.read()) > 0) {

			sb.append((char) ch);
		}
		if (sb.length() > 0)
			impl.addSenteceText(sb.toString());

		fis.close();

	}