@@ -56,7 +56,7 @@ public class GridFSInputFile extends GridFSFile {
56
56
* @param closeStreamOnPersist
57
57
indicate the passed in input stream should be closed once the data chunk persisted
58
58
*/
59
- GridFSInputFile ( GridFS fs , InputStream in , String filename , boolean closeStreamOnPersist ) {
59
+ protected GridFSInputFile ( GridFS fs , InputStream in , String filename , boolean closeStreamOnPersist ) {
60
60
_fs = fs ;
61
61
_in = in ;
62
62
_filename = filename ;
@@ -81,7 +81,7 @@ public class GridFSInputFile extends GridFSFile {
81
81
* @param filename
82
82
* Name of the file to be created.
83
83
*/
84
- GridFSInputFile ( GridFS fs , InputStream in , String filename ) {
84
+ protected GridFSInputFile ( GridFS fs , InputStream in , String filename ) {
85
85
this ( fs , in , filename , false );
86
86
}
87
87
@@ -96,7 +96,7 @@ public class GridFSInputFile extends GridFSFile {
96
96
* @param filename
97
97
* Name of the file to be created.
98
98
*/
99
- GridFSInputFile ( GridFS fs , String filename ) {
99
+ protected GridFSInputFile ( GridFS fs , String filename ) {
100
100
this ( fs , null , filename );
101
101
}
102
102
@@ -108,7 +108,7 @@ public class GridFSInputFile extends GridFSFile {
108
108
* @param fs
109
109
* The GridFS connection handle.
110
110
*/
111
- GridFSInputFile ( GridFS fs ) {
111
+ protected GridFSInputFile ( GridFS fs ) {
112
112
this ( fs , null , null );
113
113
}
114
114
@@ -271,10 +271,7 @@ private void _dumpBuffer( boolean writePartial ) {
271
271
System .arraycopy ( _buffer , 0 , writeBuffer , 0 , _currentBufferPosition );
272
272
}
273
273
274
- DBObject chunk = BasicDBObjectBuilder .start ()
275
- .add ( "files_id" , _id )
276
- .add ( "n" , _currentChunkNumber )
277
- .add ( "data" , writeBuffer ).get ();
274
+ DBObject chunk = createChunk (_id , _currentChunkNumber , writeBuffer );
278
275
279
276
_fs ._chunkCollection .save ( chunk );
280
277
@@ -283,6 +280,13 @@ private void _dumpBuffer( boolean writePartial ) {
283
280
_messageDigester .update ( writeBuffer );
284
281
_currentBufferPosition = 0 ;
285
282
}
283
+
284
+ protected DBObject createChunk (Object id , int currentChunkNumber , byte [] writeBuffer ) {
285
+ return BasicDBObjectBuilder .start ()
286
+ .add ("files_id" , id )
287
+ .add ("n" , currentChunkNumber )
288
+ .add ("data" , writeBuffer ).get ();
289
+ }
286
290
287
291
/**
288
292
* Reads a buffer full from the {@link java.io.InputStream}.
0 commit comments