Fwd: Re: [jcifs] Does jcifs use an internal buffer

Christoph Held christoph.held at est.fujitsu.com
Fri Jul 8 12:16:25 GMT 2005

Hallo Inge,

die Antwort auf die JCIFS Frage von dem JCIFS Forum:

----------  Weitergeleitete Nachricht  ----------

Subject: Re: [jcifs] Does jcifs use an internal buffer
Date: Donnerstag, 7. Juli 2005 23:53
From: "Michael B Allen" <mba2000 at ioplex.com>
To: "Christoph Held" <christoph.held at est.fujitsu.com>
Cc: jcifs at lists.samba.org

Christoph Held said:
> Fujitsu EST is delivering jcifs with the Fujitsu Enabler product.
> I am wondering if jcifs uses an internal buffer.
> I have noticed that the read() function of SmbFileInputStream class is
> quite
> slow. Wrapped in a BufferedInputStream the read() function of
> BufferedInputStream is about 500 times faster. The conclusion is, that
> jcifs
> does not use an internal buffer (at least in our configuration).
> My questions are:
> 1. Is this conclusion correct?

Yes, SmbFileInputStream (like FileInputStream) is not buffered. The byte[]
buffer provided to read() is passed directly to the underlying socket
read(). If you're seeing poor performance you should try a larger byte[]
buffer or perhaps wrap it in a BufferedInputStream. It really depends on
the situation.

> 2. Should we recommend our customers, always to wrap the
> SmbFileInputStream in
> a BufferedInputStream?

I don't know about "always". If you use a sufficiently large byte[] buffer
(e.g. 8192) I don't think you should see any real performance difference.
If anything the direct read should actually be faster. With the
BufferedInputStream you're doing two System.arraycopys.

You could just add a little note in your docs like:

"Note: SmbFileInputStream and SmbFileOutputStream are not buffered. It may
be desireable to wrap these with BufferedInputStream and
BufferedOutputStream respectively depending on the situation."


This message has been scanned for all known virus by OMNIQuad Mailwall Remote.

This message has been scanned for all known virus by OMNIQuad Mailwall Remote.

More information about the jcifs mailing list