How to obtain position in file (byte-position) from java scanner?
Posted
by september2010
on Stack Overflow
See other posts from Stack Overflow
or by september2010
Published on 2010-03-08T07:56:54Z
Indexed on
2010/03/08
8:06 UTC
Read the original article
Hit count: 560
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.
© Stack Overflow or respective owner