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
Need to close OutputStream when write file in GridFSDBFile.java(java driver, version 2.7.2)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
gen liu  
View profile  
 More options Sep 5 2012, 9:58 pm
From: gen liu <tomliu...@gmail.com>
Date: Wed, 5 Sep 2012 18:58:36 -0700 (PDT)
Local: Wed, Sep 5 2012 9:58 pm
Subject: Need to close OutputStream when write file in GridFSDBFile.java(java driver, version 2.7.2)

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 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.
Scott Hernandez  
View profile  
 More options Sep 5 2012, 10:25 pm
From: Scott Hernandez <scotthernan...@gmail.com>
Date: Wed, 5 Sep 2012 22:24:48 -0400
Local: Wed, Sep 5 2012 10:24 pm
Subject: Re: [mongodb-user] Need to close OutputStream when write file in GridFSDBFile.java(java driver, version 2.7.2)
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.


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


 
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.
gavinliu  
View profile  
 More options Sep 6 2012, 9:00 pm
From: gavinliu <tomliu...@gmail.com>
Date: Thu, 6 Sep 2012 18:00:46 -0700 (PDT)
Local: Thurs, Sep 6 2012 9:00 pm
Subject: Re: [mongodb-user] Need to close OutputStream when write file in GridFSDBFile.java(java driver, version 2.7.2)

Thanks a lot.


 
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.
End of messages
« Back to Discussions « Newer topic     Older topic »