[JAVA-1024] Change visibility of GridFSDBFile.getChunk(int) to public Created: 16/Oct/13 Updated: 03/Sep/15 Resolved: 03/Sep/15 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | GridFS |
| Affects Version/s: | 2.11.3 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Jan Hallonsten [X] | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
We are using GridFS to store multipart/mixed mime messages. We would like to read these messages from GridFS via the mongodb java driver. The messages can be large up to GB size. So if it is possible we would like you to change the visibility of the getChunk method to public. |
| Comments |
| Comment by Jeffrey Yemin [ 03/Sep/15 ] |
|
We didn't make getChunk public, but rather added markSupported, mark, and reset support in the new GridFS implementation |
| Comment by Ross Lawley [ 02/Sep/15 ] |
|
Fixed in the new GridFS implementation Mark and reset support was added in |
| Comment by Jan Hallonsten [X] [ 16/Oct/13 ] |
|
I guess that you are right it would be sufficient with an implementation of InputStream.mark() and InputStream.reset() which implies that InputStream.markSupported() is changed to return true. Then we could just implement the SharedInputStream.newStream(long start, long end) by calling GridFSDBFile.getInputStream() and then use InputStream.skip(long) to position the new stream at the correct position and then wrap that stream with our own stream implementation that keeps track of the current position and makes sure that the stream is not read past the provided end position. One disadvantage for us with that approach would be that the same chunk would have to be retrieved several times, first for the parent stream and the again for the sub streams returned by SharedInputStream.newStream. If we had access to the getChunk method we could reuse the chunk if the start position of the new stream is within the currentChunk. So if you would not like to commit to having getChunk public we could solve our use case with just mark, reset and skip but we would have more possibilities with getChunk. |
| Comment by Jeffrey Yemin [ 16/Oct/13 ] |
|
As I mentioned on mongodb-user, I'd like to consider the alternative of implementing InputStream.mark() and InputStream.reset() on com.mongodb.gridfs.GridFSDBFile.MyInputStream. Currently they both throw an exception. Would mark and reset support on the InputStream returned by GridFSDBFile#getInputStream be sufficient? |