[jcifs] SmbFile doesn't implement getInputStream() and getOut putStream()

Glass, Eric eric.glass at capitalone.com
Thu Jan 16 22:45:21 EST 2003

> -----Original Message-----
> From: Allen, Michael B (RSCH) [mailto:Michael_B_Allen at ml.com]
> Sent: Wednesday, January 15, 2003 9:28 PM
> To: 'Thomas Krammer'; 'jcifs at lists.samba.org'
> Subject: RE: [jcifs] SmbFile doesn't implement getInputStream() and
> getOut putStream()
> Yeah, I just completely forgot about this. I don't want to 
> open pandora's box so
> I've just implemented what we have in 0.6 which is:
>   getContentLength
>   getDate
>   getLastModified
>   getInputStream
> no getOutputStream yet. The URLConnection implementation 
> really needs work.
> Unfortunately I don't understand it very well. What's with 
> doOutput, doInput,
> getAllowUserInteraction?

Prior to invoking connect(), the user can manipulate the connection object:

setDoInput(true) indicates that the user expects to be able to call
getInputStream() after connecting, to read data from the resource (true is
the default).

setDoOutput(true) indicates that the user expects to be able to call
getOutputStream() after connection, to write data to the resource (false is
the default).

setAllowUserInteraction(true) indicates that the application is running in
an environment where it is acceptable to present a dialog to the application
user (i.e., prompting for authentication).  The default comes from the
static getDefaultAllowUserInteraction(), which defaults to false.

setUseCaches(true) indicates that the protocol can use cached content for
this resource if available.  The default comes from the static
getDefaultUseCaches(), which defaults to true.

So, as an example, I can say:

URL url = new URL("ftp://user:pass@server/directory/newfile.txt");
URLConnection connection = url.openConnection();
connection.setDoOutput(true); // I want to create the file
OutputStream out = connection.getOutputStream(); // implicitly calls
out.write("This is a test.".getBytes())

At any given time, a subclass of URLConnection can examine the doOutput,
etc. fields to determine whether to allow a specific operation to proceed.


The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.

More information about the jcifs mailing list