Package io.milton.httpclient
Class Folder
java.lang.Object
io.milton.httpclient.Resource
io.milton.httpclient.Folder
- Direct Known Subclasses:
Host
- Author:
- mcevoyb
-
Field Summary
FieldsFields inherited from class io.milton.httpclient.Resource
displayName, name, parent -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidchildren()createFolder(String name) downloadTo(File destFolder, ProgressListener listener) voidflush()Empty the cached children for this foldergetChild(int num) booleanhref()Returns the UN-encoded urlintvoidremoveListener(FolderListener folderListener) toString()voidvoidupload(File f, ProgressListener listener) upload(String name, InputStream content, Integer contentLength, ProgressListener listener) upload(String name, InputStream content, Long contentLength, ProgressListener listener) Upload a new fileupload(String name, InputStream content, Long contentLength, String contentType, IfMatchCheck matchCheck, ProgressListener listener) uploadFile(File f) uploadFile(File f, ProgressListener listener) Load a new file into this folder, and return a referenceuploadFile(String newName, File f, ProgressListener listener) Upload a new fileprotected voiduploadFolder(File folder, ProgressListener listener) Methods inherited from class io.milton.httpclient.Resource
addListener, copyTo, copyTo, decodePath, delete, encodedName, finalize, getCount, getCreatedDate, getLockOwner, getLockToken, getModifiedDate, host, lock, lock, moveTo, moveTo, path, post, removeListener, rename, unlock
-
Field Details
-
cache
-
-
Constructor Details
-
Folder
-
Folder
-
-
Method Details
-
addListener
public void addListener(FolderListener l) throws IOException, HttpException, NotAuthorizedException, BadRequestException -
post
public String post(String relativePath, Map<String, String> params) throws HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException- Parameters:
relativePath- - encoded but relative path. Must not start with a slashparams-- Returns:
- Throws:
HttpExceptionNotAuthorizedExceptionConflictExceptionBadRequestExceptionNotFoundException
-
downloadTo
public File downloadTo(File destFolder, ProgressListener listener) throws IOException, HttpException, NotAuthorizedException, BadRequestException - Specified by:
downloadToin classResource- Throws:
IOExceptionHttpExceptionNotAuthorizedExceptionBadRequestException
-
flush
Empty the cached children for this folder- Throws:
IOException
-
hasChildren
public boolean hasChildren() throws IOException, HttpException, NotAuthorizedException, BadRequestException -
numChildren
public int numChildren() throws IOException, HttpException, NotAuthorizedException, BadRequestException -
children
public List<? extends Resource> children() throws IOException, HttpException, NotAuthorizedException, BadRequestException -
getChild
public Resource getChild(int num) throws IOException, HttpException, NotAuthorizedException, BadRequestException -
removeListener
-
toString
-
upload
public void upload(File f) throws IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException -
upload
public void upload(File f, ProgressListener listener) throws IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException - Parameters:
f-listener-throttle- - optional, can be used to slow down the transfer- Throws:
IOExceptionHttpExceptionNotAuthorizedExceptionConflictExceptionBadRequestExceptionNotFoundException
-
uploadFile
public File uploadFile(File f) throws IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException -
uploadFile
public File uploadFile(File f, ProgressListener listener) throws FileNotFoundException, IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException Load a new file into this folder, and return a reference- Parameters:
f-listener-- Returns:
- Throws:
FileNotFoundExceptionIOExceptionHttpExceptionNotAuthorizedExceptionConflictExceptionBadRequestExceptionNotFoundException
-
uploadFile
public File uploadFile(String newName, File f, ProgressListener listener) throws FileNotFoundException, IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException Upload a new file- Parameters:
newName-f-listener-- Returns:
- Throws:
FileNotFoundExceptionIOExceptionHttpExceptionNotAuthorizedExceptionConflictExceptionBadRequestExceptionNotFoundException
-
uploadFolder
protected void uploadFolder(File folder, ProgressListener listener) throws IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException -
upload
public File upload(String name, InputStream content, Integer contentLength, ProgressListener listener) throws IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException -
upload
public File upload(String name, InputStream content, Long contentLength, ProgressListener listener) throws IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException Upload a new file- Parameters:
name-content-contentLength-listener-- Returns:
- Throws:
IOExceptionHttpExceptionNotAuthorizedExceptionConflictExceptionBadRequestExceptionNotFoundException
-
upload
public File upload(String name, InputStream content, Long contentLength, String contentType, IfMatchCheck matchCheck, ProgressListener listener) throws IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException - Parameters:
name-content-contentLength-contentType-etag- - the expected etag of the file being overwritten, or null if expecting to create newlistener-- Returns:
- Throws:
IOExceptionHttpExceptionNotAuthorizedExceptionConflictExceptionBadRequestExceptionNotFoundException
-
createFolder
public Folder createFolder(String name) throws IOException, HttpException, NotAuthorizedException, ConflictException, BadRequestException, NotFoundException -
child
public Resource child(String childName) throws IOException, HttpException, NotAuthorizedException, BadRequestException -
href
Description copied from class:ResourceReturns the UN-encoded url -
encodedUrl
- Specified by:
encodedUrlin classResource
-