The copy loop of the copy fallback: copies a provider stream to a file chunk by chunk and asks CopyBudget before EVERY chunk is written, so a copy never goes over the byte cap or below the free-space reserve.
More...
|
| enum | Outcome |
| | How the copy ended. More...
|
| |
| class | Result |
| | The outcome and the number of bytes written.
|
| |
|
| static Result | copy (InputStream in, OutputStream out, long declaredSize, long maxBytes, LongSupplier usableSpace, BooleanSupplier cancelled, byte[] buffer) throws IOException |
| |
The copy loop of the copy fallback: copies a provider stream to a file chunk by chunk and asks CopyBudget before EVERY chunk is written, so a copy never goes over the byte cap or below the free-space reserve.
Plain Java; streams, free space and the stop flag are passed in.
The caller deletes the partial file for every outcome except Outcome#COPIED.
◆ copy()
| static Result de.yaacc.share.BudgetedCopier.copy |
( |
InputStream | in, |
|
|
OutputStream | out, |
|
|
long | declaredSize, |
|
|
long | maxBytes, |
|
|
LongSupplier | usableSpace, |
|
|
BooleanSupplier | cancelled, |
|
|
byte[] | buffer ) throws IOException |
|
static |
- Parameters
-
| in | the provider stream |
| out | the target file |
| declaredSize | the size the provider declared, negative for unknown |
| maxBytes | the most that may be copied (see IncomingCache#remainingCopyBudget) |
| usableSpace | asked before each chunk: the free bytes on the volume now |
| cancelled | asked before each chunk: true to stop |
| buffer | the chunk buffer, not empty |
- Exceptions
-
| IOException | if reading or writing fails |
The documentation for this class was generated from the following file:
- /github/workspace/yaacc/src/main/java/de/yaacc/share/BudgetedCopier.java