How to obtain position in file (byte-position) from java scanner?
- by september2010
How to obtain a position in file (byte-position) from the java scanner?
Scanner scanner = new Scanner(new File("file"));
scanner.useDelimiter("abc");
scanner.hasNext();
String result = scanner.next();
and now: how to get the position of result in file (in bytes)?
Using scanner.match().start() is not the answer, because it gives the position within internal buffer.