driver-legacy/src/main/com/mongodb/gridfs/GridFSDBFile.java
public long writeTo(final OutputStream out) throws IOException {
        int nc = numChunks();
        for (int i = 0; i < nc; i++) {
            out.write(getChunk(i));
        }
        return length;
    }
public long writeTo(final OutputStream out) throws IOException {
        int nc = numChunks();
        for (int i = 0; i < nc; i++) {
            out.write(getChunk(i));
        }
        return length;
    }
Writes the file's data to an OutputStream.

@param out the OutputStream
@return number of bytes written
@throws IOException if there are problems writing to {@code out}