[jcifs] Re: SMB_COM_CLOSE does work

Michael B. Allen miallen at eskimo.com
Thu Aug 22 05:27:55 EST 2002


This is great! I love it when I messup like this :~)

But Andy,

It would be better if you sent your messages throught the jcifs at samba.org
mailing list. It's beginning to look like I'm having a conversation
with myself.

Mike

On Wed, 21 Aug 2002 12:18:10 -0700 (PDT)
andy chernow <achernow at yahoo.com> wrote:

> I just download the latest version, jcifs_0.7.0b2, and
> the only thing I could say is that there is no way to
> specify the lastWriteTime.  You made the same
> modifications to the all of the same sources I did
> with one exception, SmbFileOutputStream.
> 
> The latest version added:
> a new SmbFile.close(long) method
> a new SmbComClose constructor
> 
> but did not add anything to the SmbFileOutputStream. 
> This was what I forgot when it was not working.  I
> think if you just add this to SmbFileOutputStream,
> your golden:
> 
> SmbFileOutputStream[jcifs_0.7.0b2] Patch
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> public void close() throws IOException
> {
>    close(0L);
> }
> 
> public void close(long lastModified) throws
> IOException
> {
>    // this must be here so a time can be specified
> when
>    // the stream is done with writing.  It currently 
>    // calls file.close() which will assign 
>    // lastWriteTime to 0L, meaning currentTime.
>    file.close(lastModified);
> }
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 
> 
> Currently, there is no way to specify that time.
> smbOutputStream.close(localFile.lastModified()); is
> what I did.
> 
> My SmbFile.close(long) method is almost identical to
> yours, so I don't think there are any changes there.
> 
> I hope this is helpful becuase you have answered so
> many of my questions in a very timely manner.
> 
> Thanks,
> /sLaKr
> 
> --- "Michael B. Allen" <miallen at eskimo.com> wrote:
> > On Wed, 21 Aug 2002 13:45:08 -0400
> > "Andrew Chernow" <achernow at unitedstoragetech.com>
> > wrote:
> > 
> > > Michael,
> > >     I saw the message you posted about the lasted
> > release of the jCIFS
> > > package.
> > > 
> > > >Didn't get a chance to do NamedPipes available()
> > and it doesn't look
> > > >like setting last modified through SMB_COM_CLOSE
> > works.
> > > 
> > > I wanted to let you know that I did get
> > lastModified time working through
> > > SMB_COM_CLOSE.  I just did what you said, "...add
> > a constructor to
> > > SmbComClose.java and pass the lastWriteTime...". 
> > I made some modifications
> > > to accomplish this.
> > 
> > That's very good news. I must have done something
> > wrong. My implementation
> > of this is in 0.7.0b2. It just doesn't work. Is
> > there any chance you
> > can look at it and see what I did wrong?
> > 
> > > 
> > > SmbFile:
> > > added a close(long lastWriteTime) method.  The
> > original SmbFile.close()
> > > method now reads:
> > > 
> > > void close()
> > > {
> > >    // this is set to the regular default that was
> > being used, 0xFFFFFFFF
> > >    close(SmbComClose.DEFAULT_LAST_WRITE_TIME);
> > > }
> > > 
> > > public void close(long lastWriteTime)
> > > {
> > >    // same code as the original close() but
> > changed this line
> > >    send(new SmbComClose(fid, lastWriteTime), new
> > SmbComBlankResponse());
> > > }
> > > 
> > > 
> > > SmbFileOutputStream:
> > > added a close(long lastWriteTime) while simply
> > calls
> > > smbfile.close(lastWriteTime);
> > > 
> > > 
> > > SmbComClose:
> > > added a constructor to accept lastWriteTime as
> > argument.
> > > 
> > > I am not sure in what regards you are saying
> > lastModified doesn't work, but
> > > in the above context I have no problems.  My
> > solution was a quick hackish
> > > patch for my specific project.
> > > 
> > > Example:
> > >
> >
> ----------------------------------------------------------------------------
> > > File file              = new
> > File("/home/slakr/somefile.c");
> > > SmbFile smbFile = new SmbFile(smburl);
> > > 
> > > FileInputStream in           = new
> > FileInputStream(file);
> > > SmbFileOutputStream out = new
> > SmbFileOutputStream(smbFile);
> > > 
> > > while(....)
> > > {
> > >    // transfer the file
> > > }
> > > out.close(file.lastModified());
> > > in.close();
> > >
> >
> ----------------------------------------------------------------------------
> > > -
> > > 
> > > Anyways, that's what I did and it works like a
> > charm, after figuring out
> > > TimeZone s**t.
> > > 
> > > Thanks,
> > > /sLaKr
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > -- 
> > 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. 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> HotJobs - Search Thousands of New Jobs
> http://www.hotjobs.com
> 


-- 
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