Package com.algorithmia.data
Class DataDirectory
- java.lang.Object
-
- com.algorithmia.data.DataObject
-
- com.algorithmia.data.DataDirectory
-
public class DataDirectory extends DataObject
A data stream
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DataDirectory.DirectoryListResponse
protected class
DataDirectory.DirectoryMetadata
protected class
DataDirectory.FileMetadata
-
Nested classes/interfaces inherited from class com.algorithmia.data.DataObject
DataObject.DataObjectType
-
-
Field Summary
-
Fields inherited from class com.algorithmia.data.DataObject
client, dataType, path
-
-
Constructor Summary
Constructors Constructor Description DataDirectory(HttpClient client, java.lang.String dataUrl)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
create()
Creates this directory via the Algorithmia Data APIvoid
create(DataAcl dataAcl)
void
delete(boolean forceDelete)
Creates this directory vi the Algorithmia Data APIjava.lang.Iterable<DataDirectory>
dirs()
boolean
exists()
Determine if this Algorithmia data directory existsDataFile
file(java.lang.String filename)
Queries the DataAPI for a particular data filejava.lang.Iterable<DataFile>
files()
DataDirectoryIterator
getDirIter()
Deprecated.DataFileIterator
getFileIter()
Deprecated.protected DataDirectory.DirectoryListResponse
getPage(java.lang.String marker, java.lang.Boolean getAcl)
Gets a single page of the directory listing.DataAcl
getPermissions()
DataFile
putFile(java.io.File file)
Convenience wrapper for putting a Fileboolean
updatePermissions(DataAcl dataAcl)
-
Methods inherited from class com.algorithmia.data.DataObject
getName, getParent, getType, getUrl, isDirectory, isFile, toString
-
-
-
-
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 classDataObject
- 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
-
files
public java.lang.Iterable<DataFile> files() throws APIException
- Throws:
APIException
-
getDirIter
@Deprecated public DataDirectoryIterator getDirIter() throws APIException
Deprecated.- Throws:
APIException
-
dirs
public java.lang.Iterable<DataDirectory> dirs() throws APIException
- Throws:
APIException
-
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 APIjava.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
-
create
public void create(DataAcl dataAcl) throws APIException
- Throws:
APIException
-
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
-
getPermissions
public DataAcl getPermissions() throws APIException
- Throws:
APIException
-
updatePermissions
public boolean updatePermissions(DataAcl dataAcl) throws APIException
- Throws:
APIException
-
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
-
-