[jcifs] Re: SmbFile CopyTo size limit

Steve K skuekes at rxhealthcare.org
Tue Mar 18 15:18:36 GMT 2008


Michael B Allen <miallen <at> ioplex.com> writes:

> 
> On Wed, 12 Mar 2008 02:43:24 +0000 (UTC)
> Steve K <skuekes <at> rxhealthcare.org> wrote:
> 
... Snipped ...
> 
> Mmm, just glancing at the code it doesn't look like it could work. I
> thought it did.
> 
> In SmbFile there's an inner class called WriterThread. All instances of
> 'n' and 'off' need to be long and not int. If you're brave you could
> try making the necessary changes. Note that you'll also need to change
> the type of 'off' to long wherever it's passed to w.write(...).
> 
> Otherwise I'll put this on the TODO list.
> 
> Mike
> 

I updated the SmbFile class to support > 2G files.  It was just a couple 
of changes.  Here is the diff from 1.2.18 for SmbFile.java.

2039c2039,2040
<         int n, off;
---
>         int n;
>         long off;
2061c2062
<         synchronized void write( byte[] b, int n, SmbFile dest, int off ) {
---
>         synchronized void write( byte[] b, int n, SmbFile dest, long off ) {
2157c2158
<             int off;
---
>             long off;
2178c2179,2180
<                 i = off = 0;
---
>                 i = 0;
> 					 off = 0L;

I am using this now, as I regularly copy > 4G files and it seems to 
work just fine.

Let me know if you need more information on this.

Steve





More information about the jcifs mailing list