Re: file pointer wrong after readFully in SMBRandomAccessFile
Michael B Allen <[email protected]> Thu, 18 Apr 2013 20:54:09 -0400
| Newsgroups | gmane.network.samba.java |
|---|---|
| Message-ID | <CAGMFw4gbhX_PgbS1RdGVbCDZK5KvX9VZQT2DoLzw20oY7STrSw@mail.gmail.com> |
Hi Stefan and Richard, Not sure why I missed this before. I have added it to the TODO list and gave it a high priority. I don't do releases very often though so it might be a while before it's properly investigated and fixed. But I'll get to it eventually. Thanks for reporting the issue. Mike On Tue, Apr 9, 2013 at 7:48 AM, Stefan Risto <[email protected]> wrote: > Richard Heap <richardheap <at> london.com> writes: > > > > > > > Hi Mike et alI believe that the file pointer is being > > advanced too far following a read fully.For example, > SmbRandomAccessFile raf = new > > SmbRandomAccessFile(new > > SmbFile("smb://username:pwd <at> > server/share/foo/bar/file.dat"), > > "r"); > > raf.readFully(new byte[512]); > > System.out.println(raf.getFilePointer());reads > 512 > bytes but prints 1024. A subsequent read takes > > place at 1024 instead of 512.It looks like > readFully may be > > incrementing the file pointer as well as > > read(), which is called by > > readFully, causing a double increment.Best > Regards and thanks again > > for jcifs.Richard > > > > > I can confirm this issue. I observed the same behaviour. A workaround for > me > is to adjust the file pointer manually after every readFully using seek, > but > this is very silly. > Using this workaround I can now open a zip on the smb server and extract a > single file without streaming the whole zip file to the client (I use a > patched version of Apache commons compress' ZipFile for that) > > Please fix that bug so I can get rid of the workaround. > > Regards, > Stefan > > > > -- Michael B Allen Java Active Directory Integration http://www.ioplex.com/