com.dropbox.client2
Class DropboxAPI.DropboxInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.dropbox.client2.DropboxAPI.DropboxInputStream
- All Implemented Interfaces:
- Closeable
- Enclosing class:
- DropboxAPI<SESS_T extends Session>
public static class DropboxAPI.DropboxInputStream
- extends FilterInputStream
An InputStream for a file download that includes the associated
DropboxAPI.DropboxFileInfo. Closing this stream will cancel the associated
download request.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DropboxAPI.DropboxInputStream
public DropboxAPI.DropboxInputStream(org.apache.http.client.methods.HttpUriRequest request,
org.apache.http.HttpResponse response)
throws DropboxException
- Throws:
DropboxException
close
public void close()
throws IOException
- Closes this stream and aborts the request to Dropbox, releasing
any associated resources. No more bytes will be downloaded after
this is called.
- Specified by:
close in interface Closeable- Overrides:
close in class FilterInputStream
- Throws:
IOException - if an error occurs while closing this stream.
getFileInfo
public DropboxAPI.DropboxFileInfo getFileInfo()
- Returns the
DropboxAPI.DropboxFileInfo for the associated file.
copyStreamToOutput
public void copyStreamToOutput(OutputStream os,
ProgressListener listener)
throws DropboxIOException,
DropboxPartialFileException,
DropboxLocalStorageFullException
- Copies from a
DropboxAPI.DropboxInputStream to an
OutputStream, optionally providing updates via a
ProgressListener. You probably won't have a use for this
function because most API functions that return a
DropboxAPI.DropboxInputStream have an alternate that will copy to an
OutputStream for you.
- Parameters:
os - the stream to copy to.listener - an optional ProgressListener to receive progress
updates as the stream is copied, or null.
- Throws:
DropboxPartialFileException - if only part of the input stream was
copied.
DropboxIOException - for network-related errors.
DropboxLocalStorageFullException - if there is no more room to
write to the output stream.
DropboxException - for any other unknown errors. This is also a
superclass of all other Dropbox exceptions, so you may want to
only catch this exception which signals that some kind of error
occurred.
Copyright © 2012. All Rights Reserved.