[jcifs] skip(long) implementation in SmbFileInputStream

Michael B. Allen miallen at eskimo.com
Sun Sep 15 05:05:43 EST 2002

On Sat, 14 Sep 2002 20:53:19 +0200
"Bas Leijdekkers" <basleijdekkers at hotmail.com> wrote:

> Hi,
> I think it would be nice if the method skip(long) was implemented in
> jcifs.smb.SmbFileInputStream. The default implementation of
> java.io.InputStream just calls read(byte[], int, int) and throws away the
> results. A bit of time and bandwidth can be saved by implementing a more
> efficient version. My suggestion:
> public long skip(long n) throws IOException {
>   n = Math.min(file.length() - fp, n);
>   fp += n;
>   return n;
> }

I'm not sure you can do this without an SMB_COM_SEEK. Have tested this
on a few different servers and are you sure you getting the right thing?

> Best regards,
> Bas

A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and more importantly to tasks that have not
yet been conceived. 

More information about the jcifs mailing list