[jcifs] Need help loading a file...please

Laura McCord mccordl at southwestern.edu
Wed Jun 27 21:53:41 GMT 2007


I had already tried that but it didn't work, a 0 is still returned for the contentLength.



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

> On Wed, 27 Jun 2007 14:22:58 -0500
> Laura McCord <mccordl at southwestern.edu> wrote:
>
>> The only reason why I think it's JCIFS is because after I use "in =
>> new SmbFileInputStream" and I try to do "int contentLength =
>> in.available();" I am getting nothing as if the InputStream is empty.
>> To me that sounds like there is  a problem with me loading the file
>> using jcifs, don't you think?
>
> I think you should look at the API documentation:
>
>   "This stream class is unbuffered. Therefore this method will always
>   return 0 for streams connected to regular files."
>
> I think you want to wrap the SmbFileInputStream in a BufferedInputStream:
>
>   in = new BufferedInputStream(new SmbFileInputStream(...));
>   in.available()
>
>>
>> Thanks,
>>   Laura
>>
>> Quoting Michael B Allen <miallen at ioplex.com>:
>>
>> > Hi Laura,
>> >
>> > What you're trying to do doesn't really have anything to do with jCIFS. I
>> > suggest you try the Java forums java.sun.com.
>> >
>> > Mike
>> >
>> > On Wed, 27 Jun 2007 14:02:13 -0500
>> > Laura McCord <mccordl at southwestern.edu> wrote:
>> >
>> >> I have posted this question a couple times with no luck.
>> >>
>> >> I have made a connection to the filesystem and my file was found.
>> >> However, when I use "in = new SmbFileInputStream", is the file
>> >> loaded or do I need to read in the file still? I am confused...
>> >> PLease help me.... I have been working on this for two months.
>> >>
>> >>
>> >>
>> >>                  SmbFileInputStream in = null;
>> >>                  System.err.println("Test1"); //make sure methood
>> >> is being called
>> >>                  Config.setProperty("jcifs.netbios.wins", "ip");
>> >>                  Config.setProperty("jcifs.smb.client.domain", "domain");
>> >>                  Config.setProperty("jcifs.smb.client.username", "user");
>> >>                  Config.setProperty("jcifs.smb.client.password", "secret");
>> >>                  try{
>> >>                     in = new SmbFileInputStream("smb://ip/idworks/"
>> >> + imgPath);
>> >>                  }catch(Exception e){
>> >>                          e.printStackTrace();
>> >>                  }
>> >>
>> >>
>> >
>> >
>> > --
>> > Michael B Allen
>> > PHP Active Directory Kerberos SSO
>> > http://www.ioplex.com/
>> >
>>
>>
>
>
> --
> Michael B Allen
> PHP Active Directory Kerberos SSO
> http://www.ioplex.com/
>




More information about the jcifs mailing list