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

com.algorithmia.data.DataFileIterator Maven / Gradle / Ivy

There is a newer version: 1.0.16
Show newest version
package com.algorithmia.data;

import com.algorithmia.APIException;
import java.util.ArrayList;
import java.util.List;

public class DataFileIterator extends AbstractDataIterator {
    public DataFileIterator(DataDirectory dir) {
        super(dir);
    }

    protected void loadNextPage() throws APIException {
        List filenames = new ArrayList();
        DataDirectory.DirectoryListResponse response = dir.getPage(marker, false);

        if (response.files != null) {
            for(DataDirectory.FileMetadata meta : response.files) {
                filenames.add(meta.filename);
            }
        }

        // Update iterator state
        setChildrenAndMarker(filenames, response.marker);
    }

    protected DataFile newDataObjectInstance(String dataUri) {
        return new DataFile(dir.client, dataUri);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy