Class DataDirectory


  • public class DataDirectory
    extends DataObject
    A data stream
    • Constructor Detail

      • DataDirectory

        public DataDirectory​(HttpClient client,
                             java.lang.String dataUrl)
    • Method Detail

      • exists

        public boolean exists()
                       throws APIException
        Determine if this Algorithmia data directory exists
        Specified by:
        exists in class DataObject
        Returns:
        true iff the directory exists
        Throws:
        APIException - if there were any problems communicating with the Algorithmia API
      • getFileIter

        @Deprecated
        public DataFileIterator getFileIter()
                                     throws APIException
        Deprecated.
        Get an iterator for retrieving files in this DataDirectory The file list retrieval is done in batches, generally ~1000 files at a time
        Returns:
        the list of files
        Throws:
        APIException - if there were any problems communicating with the Algorithmia API
      • file

        public DataFile file​(java.lang.String filename)
        Queries the DataAPI for a particular data file
        Parameters:
        filename - the name of the file within this collection to get a reference for
        Returns:
        a handle to the requested file
      • putFile

        public DataFile putFile​(java.io.File file)
                         throws APIException,
                                java.io.FileNotFoundException
        Convenience wrapper for putting a File
        Parameters:
        file - a file to put into this data directory
        Returns:
        a handle to the requested file
        Throws:
        APIException - if there were any problems communicating with the Algorithmia API
        java.io.FileNotFoundException - if the specified file does not exist
      • create

        public void create()
                    throws APIException
        Creates this directory via the Algorithmia Data API
        Throws:
        APIException - if there were any problems communicating with the Algorithmia API
      • delete

        public void delete​(boolean forceDelete)
                    throws APIException
        Creates this directory vi the Algorithmia Data API
        Parameters:
        forceDelete - forces deletion of the directory even if it still has other files in it
        Throws:
        APIException - if there were any problems communicating with the Algorithmia API
      • getPage

        protected DataDirectory.DirectoryListResponse getPage​(java.lang.String marker,
                                                              java.lang.Boolean getAcl)
                                                       throws APIException
        Gets a single page of the directory listing. Subsquent pages are fetched with the returned marker value.
        Parameters:
        marker - indicates the specific page to fetch; first page is fetched if null
        Returns:
        a page of files and directories that exist within this directory
        Throws:
        APIException - if there were any problems communicating with the Algorithmia API