|
YAACC - UPNP Client and Server
|
The stop rule of the copy fallback (a provider file whose descriptor cannot seek is copied to the app's incoming directory). More...

Classes | |
| enum | Decision |
| What the copy loop does next. More... | |
Static Public Member Functions | |
| static Decision | decide (long bytesSoFar, long declaredSize, long usableSpaceBytes) |
The stop rule of the copy fallback (a provider file whose descriptor cannot seek is copied to the app's incoming directory).
Plain Java. The copy loop asks before it writes each chunk, passing the number of bytes the file will have once that chunk is written, and the free space it just read from the volume.
Decision#ABORT_TOO_BIG: more than SharedContentPolicy#MAX_COPY_BYTES bytes (exactly the cap is still fine), or the provider already DECLARED a size above the cap (nothing is copied then). A negative byte count is a caller bug and aborts too. Decision#ABORT_NO_SPACE: the usable space minus the bytes still to come (the declared size minus the bytes already copied, if the size is known) would fall below ShareLimits#COPY_FREE_SPACE_RESERVE_BYTES. A negative or zero space (the volume could not be asked) aborts. Decision#CONTINUE otherwise. Too big wins over no space. The bytes already written are already gone from the usable space the caller reads, so they are not counted twice.
|
static |
| bytesSoFar | bytes the copy will hold including the chunk about to be written |
| declaredSize | the size the provider declared, negative for unknown |
| usableSpaceBytes | the free space on the volume right now |
Referenced by de.yaacc.share.BudgetedCopier.copy().
