Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Need to close OutputStream when write file in GridFSDBFile.java(java driver, version 2.7.2)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jeff Yemin  
View profile  
 More options Sep 6 2012, 7:12 am
From: Jeff Yemin <jeff.ye...@10gen.com>
Date: Thu, 6 Sep 2012 04:12:58 -0700 (PDT)
Local: Thurs, Sep 6 2012 7:12 am
Subject: Re: [mongodb-user] Need to close OutputStream when write file in GridFSDBFile.java(java driver, version 2.7.2)

This was fixed in the 2.8.0 release:

 https://github.com/mongodb/mongo-java-driver/blob/6ae5baa424c3e515b85...

Jeff

On Wednesday, September 5, 2012 10:25:18 PM UTC-4, Scott Hernandez wrote:

> You can use the writeTo(OutputStream stream) method if you want
> control over this:

> http://api.mongodb.org/java/2.8.0/com/mongodb/gridfs/GridFSDBFile.htm...)

> The garbage collector will clean it up, but it is better to do it
> sooner than later on high volume servers.

> On Wed, Sep 5, 2012 at 9:58 PM, gen liu <toml...@gmail.com <javascript:>>
> wrote:
> > In java driver, I saw it has not close the OutputStream before return,
> here
> > is the code(GridFSDBFile.java, line 66, version 2.7.2):

> >     public long writeTo( File f ) throws IOException {
> >         return writeTo( new FileOutputStream( f ) );
> >     }

> >     /**
> >      * Writes the file's data to an OutputStream
> >      * @param out the OutputStream
> >      * @return
> >      * @throws IOException
> >      */
> >     public long writeTo( OutputStream out )
> >         throws IOException {
> >         final int nc = numChunks();
> >         for ( int i=0; i<nc; i++ ){
> >             out.write( getChunk( i ) );
> >         }
> >         return _length; // is need to close out before return ? or the
> > destructor function will close it?
> >     }

> > --
> > You received this message because you are subscribed to the Google
> > Groups "mongodb-user" group.
> > To post to this group, send email to mongod...@googlegroups.com<javascript:>
> > To unsubscribe from this group, send email to
> > mongodb-user...@googlegroups.com <javascript:>
> > See also the IRC channel -- freenode.net#mongodb


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.