E
Eric Capps
So I've noticed that in the BufferedReader class, the skip(long n)
method, which is supposed to skip n characters, returns a long
corresponding the number of characters actually skipped. I have tested
this, and indeed, the skip() method can return a value that is NOT equal
to n, that is, the number of characters it is supposed to skip. This
happens more often than not in my uses of it, often by a very large amount.
Why would skip do anything other than skip the exact amount of
characters it is supposed to? Is there any implementation of the Reader
class that offers some sort of guarantee on this?
More generally: I'm using BufferedReader to read files over HTTP and may
want to skip to a particular byte of a file, is using BufferedReader a
good approach? Is there perhaps instead a way I could manipulate the
HTTP header to do this?
method, which is supposed to skip n characters, returns a long
corresponding the number of characters actually skipped. I have tested
this, and indeed, the skip() method can return a value that is NOT equal
to n, that is, the number of characters it is supposed to skip. This
happens more often than not in my uses of it, often by a very large amount.
Why would skip do anything other than skip the exact amount of
characters it is supposed to? Is there any implementation of the Reader
class that offers some sort of guarantee on this?
More generally: I'm using BufferedReader to read files over HTTP and may
want to skip to a particular byte of a file, is using BufferedReader a
good approach? Is there perhaps instead a way I could manipulate the
HTTP header to do this?