|
YAACC - UPNP Client and Server
|
Opens a shared file after the user confirmed: the provider's descriptor is held if it can seek (HeldFileSource), otherwise the file is copied to cache/incoming/ and the copy is held (and deleted when the source is closed).
More...

Classes | |
| class | Opened |
| The first step: what the provider handed out. | |
| class | OpenException |
The file cannot be shared; getReason() says why. | |
| enum | Reason |
| Why a file could not be opened. More... | |
Static Public Member Functions | |
| static Opened | openDescriptor (ContentResolver resolver, Uri uri) throws OpenException |
| Opens the provider's descriptor and holds it if it can seek. | |
| static PositionalSource | copyAndHold (AssetFileDescriptor afd, File incomingDir) throws OpenException |
The copy fallback: copies the provider's descriptor to cache/incoming/ (byte cap, free space reserve, directory cap, one copy at a time) and holds the copy; the returned source deletes the copy when it is closed. | |
Opens a shared file after the user confirmed: the provider's descriptor is held if it can seek (HeldFileSource), otherwise the file is copied to cache/incoming/ and the copy is held (and deleted when the source is closed).
Thin glue: the rules (what to copy, how much, how to stop) live in the plain-Java classes it calls.
Worker thread only: every call goes to the provider. The caller owns the returned source and must close it; this class closes and deletes everything it opened itself when it fails. Nothing here logs the URI, the name or the provider's text.
|
static |
The copy fallback: copies the provider's descriptor to cache/incoming/ (byte cap, free space reserve, directory cap, one copy at a time) and holds the copy; the returned source deletes the copy when it is closed.
Closes afd in every case and deletes a partial copy on every failure.
Takes as long as the copy takes, off the main thread, but at most ShareLimits#COPY_MAX_MILLIS: the copy runs on its own worker and this call waits with a deadline (WatchedCopy), because a provider whose pipe never delivers a byte would block the read for ever. At the deadline the descriptor is closed from this thread (which wakes the blocked read), the partial file is deleted, the copy slot is given back and the call fails, even if the worker stays stuck.
| OpenException | for every failure |

|
static |
Opens the provider's descriptor and holds it if it can seek.
A provider call that can block: run it through BoundedCall, never on the main thread.
| resolver | the content resolver |
| uri | the validated shared URI |
| OpenException | for every failure (nothing is left open) |
