Hi,

the JSR 353 API says about JsonLocation.getStreamOffset()

"long getStreamOffset()

Return the stream offset into the input source this location is
pointing to. If the input source is a file or a byte stream then this
is the byte offset into that stream, but if the input source is a
character media then the offset is the character offset. Returns -1 if
there is no offset available."

There are IMHO two issues here:

1) How can we know that the input source is a file(stream)? We can
only know if the parser  read from an Inputstream (=byte stream) or
from an Reader (=character stream). Wording here is unclear/ambiguous.

2) Since a UTF8 or UTF16 character can map to one, two, three or four
bytes the output can be very confusing (especially if the user don't
know whether the parser was constructed form a byte or character
stream and which charset is used).

Seems that the RI is not implementing these distinctions, if i looked
correctly they always return character offsets.

So want we want do to?

Thanks
Hendrik


-- 
Hendrik Saly (salyh, hendrikdev22)
@hendrikdev22
PGP: 0x22D7F6EC

Reply via email to