All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mongodb.MongoQueryCursor Maven / Gradle / Ivy

Go to download

An extension to the MongoDB Java Driver library that goes beyond what the GridFS feature supports. Compressed file storage, zip files, temporary files

There is a newer version: 0.10.0
Show newest version
package org.mongodb;

import org.mongodb.connection.ServerAddress;

import com.mongodb.DBCursor;

public class MongoQueryCursor implements MongoCursor {

    private DBCursor surrogate;

    public MongoQueryCursor(final DBCursor cursor) {
        this.surrogate = cursor;

    }

    @SuppressWarnings("unchecked")
    public T next() {
        return (T) new Document(surrogate.next());
    }

    public boolean hasNext() {
        return surrogate.hasNext();
    }

    @Override
    public void close() {

        surrogate.close();
    }

    @Override
    public void remove() {
        surrogate.remove();
    }

    @Override
    public ServerAddress getServerAddress() {

        return new ServerAddress(surrogate.getServerAddress().getHost(), surrogate.getServerAddress().getPort());
    }

    @Override
    public ServerCursor getServerCursor() {
        throw new UnsupportedOperationException();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy