public class DataDirectory extends DataObject
Modifier and Type | Class and Description |
---|---|
protected class |
DataDirectory.DirectoryListResponse |
protected class |
DataDirectory.DirectoryMetadata |
protected class |
DataDirectory.FileMetadata |
client, path
Constructor and Description |
---|
DataDirectory(HttpClient client,
java.lang.String dataUrl) |
Modifier and Type | Method and Description |
---|---|
void |
create()
Creates this directory via the Algorithmia Data API
|
void |
delete(boolean forceDelete)
Creates this directory vi the Algorithmia Data API
|
boolean |
exists()
Determine if this Algorithmia data directory exists
|
DataFile |
file(java.lang.String filename)
Queries the DataAPI for a particular data file
|
DataDirectoryIterator |
getDirIter() |
DataFileIterator |
getFileIter()
Get an iterator for retrieving files in this DataDirectory
The file list retrieval is done in batches, generally ~1000 files at a time
|
protected DataDirectory.DirectoryListResponse |
getPage(java.lang.String marker)
Gets a single page of the directory listing.
|
DataFile |
putFile(java.io.File file)
Convenience wrapper for putting a File
|
getName, getParent, getUrl, toString
public DataDirectory(HttpClient client, java.lang.String dataUrl)
public boolean exists() throws APIException
exists
in class DataObject
APIException
- if there were any problems communicating with the Algorithmia APIpublic DataFileIterator getFileIter() throws APIException
APIException
- if there were any problems communicating with the Algorithmia APIpublic DataDirectoryIterator getDirIter() throws APIException
APIException
public DataFile file(java.lang.String filename)
filename
- the name of the file within this collection to get a reference forpublic DataFile putFile(java.io.File file) throws APIException, java.io.FileNotFoundException
file
- a file to put into this data directoryAPIException
- if there were any problems communicating with the Algorithmia APIjava.io.FileNotFoundException
- if the specified file does not existpublic void create() throws APIException
APIException
- if there were any problems communicating with the Algorithmia APIpublic void delete(boolean forceDelete) throws APIException
forceDelete
- forces deletion of the directory even if it still has other files in itAPIException
- if there were any problems communicating with the Algorithmia APIprotected DataDirectory.DirectoryListResponse getPage(java.lang.String marker) throws APIException
marker
- indicates the specific page to fetch; first page is fetched if nullAPIException
- if there were any problems communicating with the Algorithmia API